!function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(i.self=i),"undefined"==typeof File&&(i.File=function(){});var e=Array.prototype,r=e.forEach,s=e.indexOf,n=null==i?void 0:i.navigator,o=null==i?void 0:i.document,a=null==i?void 0:i.location,l=null==i?void 0:i.fetch,u=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,h=null==i?void 0:i.AbortController,d=null==n?void 0:n.userAgent,v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"1.360.0"};function f(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function p(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function _(){return _=Object.assign?Object.assign.bind():function(t){for(var i=1;i{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function w(t,i){return-1!==t.indexOf(i)}var x=function(t){return t.trim()},E=function(t){return t.replace(/^\$/,"")};var S=Array.isArray,k=Object.prototype,P=k.hasOwnProperty,T=k.toString,I=S||function(t){return"[object Array]"===T.call(t)},R=t=>"function"==typeof t,C=t=>t===Object(t)&&!I(t),F=t=>{if(C(t)){for(var i in t)if(P.call(t,i))return!1;return!0}return!1},O=t=>void 0===t,M=t=>"[object String]"==T.call(t),A=t=>M(t)&&0===t.trim().length,D=t=>null===t,j=t=>O(t)||D(t),L=t=>"[object Number]"==T.call(t)&&t==t,N=t=>L(t)&&t>0,z=t=>"[object Boolean]"===T.call(t),U=t=>t instanceof FormData,H=t=>w(m,t);function B(t){return null===t||"object"!=typeof t}function q(t,i){return Object.prototype.toString.call(t)==="[object "+i+"]"}function W(t){return!O(Event)&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var G=[!0,"true",1,"1","yes"],V=t=>w(G,t),J=[!1,"false",0,"0","no"];function K(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),L(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):t0){var s=r*this.m;t.tokens=Math.min(t.tokens+s,this.o),t.lastAccess=t.lastAccess+r*this.$}}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.t[r];return s?this.S(s,e):(s={tokens:this.o,lastAccess:e},this.t[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.i)||i.call(this,t)),0===s.tokens)}stop(){this.t={}}}var X="Mobile",Q="iOS",Z="Android",tt="Tablet",it=Z+" "+tt,et="iPad",rt="Apple",st=rt+" Watch",nt="Safari",ot="BlackBerry",at="Samsung",lt=at+"Browser",ut=at+" Internet",ht="Chrome",dt=ht+" OS",vt=ht+" "+Q,ct="Internet Explorer",ft=ct+" "+X,pt="Opera",_t=pt+" Mini",gt="Edge",mt="Microsoft "+gt,bt="Firefox",yt=bt+" "+Q,wt="Nintendo",xt="PlayStation",$t="Xbox",Et=Z+" "+X,St=X+" "+nt,kt="Windows",Pt=kt+" Phone",Tt="Nokia",It="Ouya",Rt="Generic",Ct=Rt+" "+X.toLowerCase(),Ft=Rt+" "+tt.toLowerCase(),Ot="Konqueror",Mt="(\\d+(\\.\\d+)?)",At=new RegExp("Version/"+Mt),Dt=new RegExp($t,"i"),jt=new RegExp(xt+" \\w+","i"),Lt=new RegExp(wt+" \\w+","i"),Nt=new RegExp(ot+"|PlayBook|BB10","i"),zt={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var Ut,Ht,Bt,qt=(t,i)=>i&&w(i,rt)||function(t){return w(t,nt)&&!w(t,ht)&&!w(t,Z)}(t),Wt=function(t,i){return i=i||"",w(t," OPR/")&&w(t,"Mini")?_t:w(t," OPR/")?pt:Nt.test(t)?ot:w(t,"IE"+X)||w(t,"WPDesktop")?ft:w(t,lt)?ut:w(t,gt)||w(t,"Edg/")?mt:w(t,"FBIOS")?"Facebook "+X:w(t,"UCWEB")||w(t,"UCBrowser")?"UC Browser":w(t,"CriOS")?vt:w(t,"CrMo")||w(t,ht)?ht:w(t,Z)&&w(t,nt)?Et:w(t,"FxiOS")?yt:w(t.toLowerCase(),Ot.toLowerCase())?Ot:qt(t,i)?w(t,X)?St:nt:w(t,bt)?bt:w(t,"MSIE")||w(t,"Trident/")?ct:w(t,"Gecko")?bt:""},Gt={[ft]:[new RegExp("rv:"+Mt)],[mt]:[new RegExp(gt+"?\\/"+Mt)],[ht]:[new RegExp("("+ht+"|CrMo)\\/"+Mt)],[vt]:[new RegExp("CriOS\\/"+Mt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Mt)],[nt]:[At],[St]:[At],[pt]:[new RegExp("(Opera|OPR)\\/"+Mt)],[bt]:[new RegExp(bt+"\\/"+Mt)],[yt]:[new RegExp("FxiOS\\/"+Mt)],[Ot]:[new RegExp("Konqueror[:/]?"+Mt,"i")],[ot]:[new RegExp(ot+" "+Mt),At],[Et]:[new RegExp("android\\s"+Mt,"i")],[ut]:[new RegExp(lt+"\\/"+Mt)],[ct]:[new RegExp("(rv:|MSIE )"+Mt)],Mozilla:[new RegExp("rv:"+Mt)]},Vt=function(t,i){var e=Wt(t,i),r=Gt[e];if(O(r))return null;for(var s=0;s[$t,t&&t[1]||""]],[new RegExp(wt,"i"),[wt,""]],[new RegExp(xt,"i"),[xt,""]],[Nt,[ot,""]],[new RegExp(kt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Pt,""];if(new RegExp(X).test(i)&&!/IEMobile\b/.test(i))return[kt+" "+X,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],s=zt[r]||"";return/arm/i.test(i)&&(s="RT"),[kt,s]}return[kt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[Q,i.join(".")]}return[Q,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=O(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Z+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Z+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[Z,i.join(".")]}return[Z,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[dt,""]],[/Linux|debian/i,["Linux",""]]],Kt=function(t){return Lt.test(t)?wt:jt.test(t)?xt:Dt.test(t)?$t:new RegExp(It,"i").test(t)?It:new RegExp("("+Pt+"|WPDesktop)","i").test(t)?Pt:/iPad/.test(t)?et:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?st:Nt.test(t)?ot:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Tt,"i").test(t)?Tt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(X).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Z:it:new RegExp("(pda|"+X+")","i").test(t)?Ct:new RegExp(tt,"i").test(t)&&!new RegExp(tt+" pc","i").test(t)?Ft:""},Yt=t=>t instanceof Error;function Xt(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Bt&&e.length===Ht||(Ht=e.length,Bt=e.reduce(((e,r)=>{Ut||(Ut={});var s=Ut[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=i[r];if(l&&u){e[l]=u,Ut[r]=[l,u];break}}return e}),{})),Bt}}class Qt{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return p((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&I(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),_({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return p((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,_({},i,{handled:!0}))),o}buildParsingContext(t){var i;return{chunkIdMap:Xt(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(r<=4){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return _({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var Zt="?";function ti(t,i,e,r,s){var n={platform:t,filename:i,function:""===e?Zt:e,in_app:!0};return O(r)||(n.lineno=r),O(s)||(n.colno=s),n}var ii=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:Zt,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},ei=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ri=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,si=/\((\S*)(?::(\d+))(?::(\d+))\)/,ni=(t,i)=>{var e=ei.exec(t);if(e){var[,r,s,n]=e;return ti(i,r,Zt,+s,+n)}var o=ri.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=si.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=ii(o[1]||Zt,o[2]);return ti(i,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},oi=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ai=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,li=(t,i)=>{var e=oi.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=ai.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||Zt;return[n,s]=ii(n,s),ti(i,s,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ui=/\(error: (.*)\)/,hi=50;function di(){return function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r1024)){var l=ui.test(a)?a.replace(ui,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of e){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=hi)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,hi).map((t=>{return _({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||Zt});var e}))}(s)}}("web:javascript",ni,li)}class vi{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=M(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return q(t,"DOMException")}isDOMError(t){return q(t,"DOMError")}}class ci{match(t){return(t=>t instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return e.error&&"string"==typeof e.error.message?String(e.error.message):String(e)}getStack(t){return t.stacktrace||t.stack||void 0}}class fi{constructor(){}match(t){return q(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e,r=i.apply(t.error);return r||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var pi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class _i{match(t){return"string"==typeof t}coerce(t,i){var e,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(pi);return r&&(i=r[1],e=r[2]),[i,e]}}var gi=["fatal","error","warning","log","info","debug"];function mi(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(!(s.length>i))return r===e.length||s.length<=i?s:s.slice(0,i)+"..."}return""}class bi{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r=this.getErrorPropertyFromObject(t);return r?i.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(e=i.syntheticException)?void 0:e.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return W(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+mi(t)}isSeverityLevel(t){return M(t)&&!A(t)&&gi.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var e=t[i];if(Yt(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class yi{match(t){return W(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+mi(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class wi{match(t){return B(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class xi{match(t){return q(t,"PromiseRejectionEvent")}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return B(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){if(B(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var $i=function(i,e){var{debugEnabled:r}=void 0===e?{}:e,s={k:function(e){if(t&&(c.DEBUG||v.POSTHOG_DEBUG||r)&&!O(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;a{s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>$i(i+" "+t,e)};return s},Ei=$i("[PostHog.js]"),Si=Ei.createLogger,ki=Si("[ExternalScriptsLoader]"),Pi=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return ki.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var s,n=function(){if(r[a].src===i){var t=r[a];return t.__posthog_loading_callback_fired?{v:e()}:(t.addEventListener("load",(i=>{t.__posthog_loading_callback_fired=!0,e(void 0,i)})),t.onerror=t=>e(t),{v:void 0})}},a=0;a{if(!o)return e("document not found");var r=o.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>e(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)o.head.appendChild(r);else{var s,n=o.querySelectorAll("body > script");if(n.length>0)null==(s=n[0].parentNode)||s.insertBefore(r,n[0]);else o.body.appendChild(r)}};null!=o&&o.body?l():null==o||o.addEventListener("DOMContentLoaded",l)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{var r="/static/"+i+".js?v="+t.version;if("remote-config"===i&&(r="/array/"+t.config.token+"/config.js"),"toolbar"===i){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=t.requestRouter.endpointFor("assets",r);Pi(t,n,e)},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);Pi(t,r,e)};var Ti={};function Ii(t,i,e){if(I(t))if(r&&t.forEach===r)t.forEach(i,e);else if("length"in t&&t.length===+t.length)for(var s=0,n=t.length;s1?i-1:0),r=1;r1?i-1:0),r=1;r0||L(t))&&(i[e]=t)})),i};function ji(t,i){return e=t,r=t=>M(t)&&!D(i)?t.slice(0,i):t,s=new Set,function t(i,e){return i!==Object(i)?r?r(i,e):i:s.has(i)?void 0:(s.add(i),I(i)?(n=[],Ii(i,(i=>{n.push(t(i))}))):(n={},Ri(i,((i,e)=>{s.has(i)||(n[e]=t(i,e))}))),n);var n}(e);var e,r,s}var Li=["herokuapp.com","vercel.app","netlify.app"];function Ni(t){var i=null==t?void 0:t.hostname;if(!M(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of Li)if(e===r)return!1;return!0}function zi(t,i){for(var e=0;e0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Ee(s)}toString(){for(var t="",i=0;i>>4)+$e.charAt(15&this.bytes[i]),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Ee(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;i<16;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class Se{constructor(){this.P=0,this.T=0,this.I=new Te}generate(){var t=this.generateOrAbort();if(O(t)){this.P=0;var i=this.generateOrAbort();if(O(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.P)this.P=t,this.R();else{if(!(t+1e4>this.P))return;this.T++,this.T>4398046511103&&(this.P++,this.R())}return Ee.fromFieldsV7(this.P,Math.trunc(this.T/Math.pow(2,30)),this.T&Math.pow(2,30)-1,this.I.nextUint32())}R(){this.T=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var ke,Pe=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;icrypto.getRandomValues(t));class Te{constructor(){this.C=new Uint32Array(8),this.F=1/0}nextUint32(){return this.F>=this.C.length&&(Pe(this.C),this.F=0),this.C[this.F++]}}var Ie=()=>Re().toString(),Re=()=>(ke||(ke=new Se)).generate(),Ce="";var Fe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Oe(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=o),Ce)return Ce;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Ie();!Ce&&r--;){var n=e.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(s)&&(i.cookie=a+";max-age=0",Ce=n)}return Ce}(t);if(!e){var r=(t=>{var i=t.match(Fe);return i?i[0]:""})(t);r!==e&&Ei.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}var Me={O:()=>!!o,M:function(t){Ei.error("cookieStore error: "+t)},A:function(t){if(o){try{for(var i=t+"=",e=o.cookie.split(";").filter((t=>t.length)),r=0;r3686.4&&Ei.warn("cookieStore warning: large cookie, len="+h.length),o.cookie=h,h}catch(t){return}},L:function(t,i){if(null!=o&&o.cookie)try{Me.j(t,"",-1,i)}catch(t){return}}},Ae=null,De={O:function(){if(!D(Ae))return Ae;var i=!0;if(O(t))i=!1;else try{var e="__mplssupport__";De.j(e,"xyz"),'"xyz"'!==De.A(e)&&(i=!1),De.L(e)}catch(t){i=!1}return i||Ei.error("localStorage unsupported; falling back to cookie store"),Ae=i,i},M:function(t){Ei.error("localStorage error: "+t)},A:function(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){De.M(t)}return null},D:function(t){try{return JSON.parse(De.A(t))||{}}catch(t){}return null},j:function(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){De.M(t)}},L:function(i){try{null==t||t.localStorage.removeItem(i)}catch(t){De.M(t)}}},je=["$device_id","distinct_id",ee,re,be,me,ce],Le={},Ne={O:function(){return!0},M:function(t){Ei.error("memoryStorage error: "+t)},A:function(t){return Le[t]||null},D:function(t){return Le[t]||null},j:function(t,i){Le[t]=i},L:function(t){delete Le[t]}},ze=null,Ue={O:function(){if(!D(ze))return ze;if(ze=!0,O(t))ze=!1;else try{var i="__support__";Ue.j(i,"xyz"),'"xyz"'!==Ue.A(i)&&(ze=!1),Ue.L(i)}catch(t){ze=!1}return ze},M:function(t){Ei.error("sessionStorage error: ",t)},A:function(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){Ue.M(t)}return null},D:function(t){try{return JSON.parse(Ue.A(t))||null}catch(t){}return null},j:function(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){Ue.M(t)}},L:function(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){Ue.M(t)}}},He=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class Be{constructor(t){this._instance=t}get N(){return this._instance.config}get consent(){return this.U()?He.DENIED:this.H}isOptedOut(){return"always"===this.N.cookieless_mode||(this.consent===He.DENIED||this.consent===He.PENDING&&(this.N.opt_out_capturing_by_default||"on_reject"===this.N.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===He.DENIED}optInOut(t){this.B.j(this.q,t?1:0,this.N.cookie_expiration,this.N.cross_subdomain_cookie,this.N.secure_cookie)}reset(){this.B.L(this.q,this.N.cross_subdomain_cookie)}get q(){var{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get H(){var t=this.B.A(this.q);return V(t)?He.GRANTED:w(J,t)?He.DENIED:He.PENDING}get B(){if(!this.W){var t=this.N.opt_out_capturing_persistence_type;this.W="localStorage"===t?De:Me;var i="localStorage"===t?Me:De;i.A(this.q)&&(this.W.A(this.q)||this.optInOut(V(i.A(this.q))),i.L(this.q,this.N.cross_subdomain_cookie))}return this.W}U(){return!!this.N.respect_dnt&&!!zi([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,v.doNotTrack],(t=>V(t)))}}var qe=Si("[Dead Clicks]"),We=()=>!0,Ge=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Qi)),r=t.instance.config.capture_dead_clicks;return z(r)?r:!!C(r)||e};class Ve{get lazyLoadedDeadClicksAutocapture(){return this.G}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Qi]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.V((()=>{this.J()})):this.stop()}V(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?qe.error("failed to load script",i):t()}))}J(){var t;if(o){if(!this.G&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=C(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.G=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.G.start(o),qe.info("starting...")}}else qe.error("`document` not found. Cannot start.")}stop(){this.G&&(this.G.stop(),this.G=void 0,qe.info("stopping..."))}}var Je=Si("[SegmentIntegration]");function Ke(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Ie();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(ce,"identified")),i()},s=e.user();"then"in s&&R(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Je.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Je.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Je.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,"$pageview"),identify:t=>i(t,"$identify"),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}var Ye="posthog-js";function Xe(t,i){var{organization:e,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===i?{}:i;return i=>{var a,l,u,h,d;if(!("*"===n||n.includes(i.level))||!t.__loaded)return i;i.tags||(i.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(a=i.exception)?void 0:a.values)||[],p=f.map((t=>_({},t,{stacktrace:t.stacktrace?_({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>_({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(l=f[0])?void 0:l.value)||i.message,$exception_type:null==(u=f[0])?void 0:u.type,$exception_level:i.level,$exception_list:p,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||i.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:i.tags};(e&&r&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),o)&&(null==(c=t.exceptions)||c.sendExceptionEvent(g));return i}}class Qe{constructor(t,i,e,r,s,n){this.name=Ye,this.setupOnce=function(o){o(Xe(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Ze{constructor(t){this.K=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength)&&(Ei.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Y=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.X()}X(){var t;this.Z=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.K)}destroy(){var t;null==(t=this.Z)||t.call(this),this.Z=void 0}doPageView(i,e){var r,s=this.tt(i,e);return this.Y={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.tt(t,null==(i=this.Y)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Y)?void 0:t.pageViewId}}tt(t,i){var e=this.Y;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(O(n)||O(o)||O(a)||O(l)||O(u)||O(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n<=1?1:K(o/n,0,1,Ei),v=n<=1?1:K(a/n,0,1,Ei),c=l<=1?1:K(u/l,0,1,Ei),f=l<=1?1:K(h/l,0,1,Ei);r=Ci(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var tr=t=>{var i=null==o?void 0:o.createElement("a");return O(i)?null:(i.href=t,i)},ir=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return Ri(t,(function(t,i){O(t)||O(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)},er=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s",ur=["li_fat_id"];function hr(t,i,e){if(!o)return{};var r,s=i?Fi([],or,e||[]):[],n=dr(rr(o.URL,s,lr),t),a=(r={},Ri(ur,(function(t){var i=Me.A(t);r[t]=i||null})),r);return Ci(a,n)}function dr(t,i){var e=ar.concat(i||[]),r={};return Ri(e,(function(i){var e=er(t,i);r[i]=e||null})),r}function vr(t){var i=function(t){return t?0===t.search(nr+"google.([^/?]*)")?"google":0===t.search(nr+"bing.com")?"bing":0===t.search(nr+"yahoo.com")?"yahoo":0===t.search(nr+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!D(i)){r.$search_engine=i;var s=o?er(o.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function cr(){return navigator.language||navigator.userLanguage}function fr(){return(null==o?void 0:o.referrer)||"$direct"}function pr(t,i){var e=t?Fi([],or,i||[]):[],r=null==a?void 0:a.href.substring(0,1e3);return{r:fr().substring(0,1e3),u:r?rr(r,e,lr):void 0}}function _r(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:"$direct"==e?"$direct":null==(i=tr(e))?void 0:i.host};if(r){s.$current_url=r;var n=tr(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=dr(r);Ci(s,o)}if(e){var a=vr(e);Ci(s,a)}return s}function gr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function mr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function br(i,e){var r,s,n,o;if(!d)return{};var l,u,h,v,f,p,_,g,m=i?Fi([],or,e||[]):[],[b,y]=function(t){for(var i=0;i0?Math.min(null!==(f=null==h?void 0:h.screenWidth)&&void 0!==f?f:0,null!==(p=null==h?void 0:h.screenHeight)&&void 0!==p?p:0)/(null!==(_=null==h?void 0:h.devicePixelRatio)&&void 0!==_?_:1)>=600?tt:X:"Desktop"),$timezone:gr(),$timezone_offset:mr()}),{$current_url:rr(null==a?void 0:a.href,m,lr),$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:Vt(d,navigator.vendor),$browser_language:cr(),$browser_language_prefix:(l=cr(),"string"==typeof l?l.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:"web",$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var yr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class wr{constructor(t,i){this.N=t,this.props={},this.it=!1,this.et=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.B=this.rt(t),this.load(),t.debug&&Ei.info("Persistence loaded",t.persistence,_({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.st}rt(i){-1===yr.indexOf(i.persistence.toLowerCase())&&(Ei.critical("Unknown persistence type "+i.persistence+"; falling back to localStorage+cookie"),i.persistence="localStorage+cookie");var e=function(i){void 0===i&&(i=[]);var e=[...je,...i];return _({},De,{D:function(t){try{var i={};try{i=Me.D(t)||{}}catch(t){}var e=Ci(i,JSON.parse(De.A(t)||"{}"));return De.j(t,e),e}catch(t){}return null},j:function(t,i,r,s,n,o){try{De.j(t,i,void 0,void 0,o);var a={};e.forEach((t=>{i[t]&&(a[t]=i[t])})),Object.keys(a).length&&Me.j(t,a,r,s,n,o)}catch(t){De.M(t)}},L:function(i,e){try{null==t||t.localStorage.removeItem(i),Me.L(i,e)}catch(t){De.M(t)}}})}(i.cookie_persisted_properties||[]),r=i.persistence.toLowerCase();return"localstorage"===r&&De.O()?De:"localstorage+cookie"===r&&e.O()?e:"sessionstorage"===r&&Ue.O()?Ue:"memory"===r?Ne:"cookie"===r?Me:e.O()?e:Me}nt(t){var i=null!=t?t:this.N.feature_flag_cache_ttl_ms;if(!i||i<=0)return!1;var e=this.props[ve];return!e||"number"!=typeof e||Date.now()-e>i}properties(){var t={};return Ri(this.props,((i,e)=>{if(e===se&&C(i)){if(!this.nt())for(var r=Object.keys(i),n=0;n{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.props[e]=t,r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(C(t)){this.ot=O(i)?this.dt:i;var e=!1;if(Ri(t,((i,r)=>{t.hasOwnProperty(r)&&this.props[r]!==i&&(this.props[r]=i,e=!0)})),e)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.it){var t=hr(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);F(Di(t))||this.register(t),this.it=!0}}update_search_keyword(){var t;this.register((t=null==o?void 0:o.referrer)?vr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:fr(),$referring_domain:null!=o&&o.referrer&&(null==(t=tr(o.referrer))?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[_e]||this.props[ge]||this.register_once({[me]:pr(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Ri([ge,_e],(i=>{var e=this.props[i];e&&Ri(e,(function(i,e){t["$initial_"+E(e)]=i}))}));var i,e,r=this.props[me];if(r){var s=(i=_r(r),e={},Ri(i,(function(t,i){e["$initial_"+E(i)]=t})),e);Ci(t,s)}return t}safe_merge(t){return Ri(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.dt=this.ot=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!e),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==i.persistence||!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[])){var r=this.rt(t),s=this.props;this.clear(),this.B=r,this.props=s,this.save()}}set_disabled(t){this.st=t,this.st?this.remove():this.save()}set_cross_subdomain(t){t!==this.ut&&(this.ut=t,this.remove(),this.save())}set_secure(t){t!==this.ht&&(this.ht=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[Wi]||{};e[t]=i,this.props[Wi]=e,this.save()}remove_event_timer(t){var i=(this.props[Wi]||{})[t];return O(i)||(delete this.props[Wi][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var xr="events",$r="cancelEvents",Er="popover",Sr="api",kr="widget",Pr="survey shown",Tr="survey dismissed",Ir="survey sent",Rr="$survey_id",Cr="$survey_iteration",Fr="$survey_last_seen_date",Or="popover",Mr="inline",Ar=function(t){return t.SHOWN="product tour shown",t.DISMISSED="product tour dismissed",t.COMPLETED="product tour completed",t.STEP_SHOWN="product tour step shown",t.STEP_COMPLETED="product tour step completed",t.BUTTON_CLICKED="product tour button clicked",t.STEP_SELECTOR_FAILED="product tour step selector failed",t.BANNER_CONTAINER_SELECTOR_FAILED="product tour banner container selector failed",t.BANNER_ACTION_CLICKED="product tour banner action clicked",t}({}),Dr=function(t){return t.TOUR_ID="$product_tour_id",t.TOUR_NAME="$product_tour_name",t.TOUR_ITERATION="$product_tour_iteration",t.TOUR_RENDER_REASON="$product_tour_render_reason",t.TOUR_STEP_ID="$product_tour_step_id",t.TOUR_STEP_ORDER="$product_tour_step_order",t.TOUR_STEP_TYPE="$product_tour_step_type",t.TOUR_DISMISS_REASON="$product_tour_dismiss_reason",t.TOUR_BUTTON_TEXT="$product_tour_button_text",t.TOUR_BUTTON_ACTION="$product_tour_button_action",t.TOUR_BUTTON_LINK="$product_tour_button_link",t.TOUR_BUTTON_TOUR_ID="$product_tour_button_tour_id",t.TOUR_STEPS_COUNT="$product_tour_steps_count",t.TOUR_STEP_SELECTOR="$product_tour_step_selector",t.TOUR_STEP_SELECTOR_FOUND="$product_tour_step_selector_found",t.TOUR_STEP_ELEMENT_TAG="$product_tour_step_element_tag",t.TOUR_STEP_ELEMENT_ID="$product_tour_step_element_id",t.TOUR_STEP_ELEMENT_CLASSES="$product_tour_step_element_classes",t.TOUR_STEP_ELEMENT_TEXT="$product_tour_step_element_text",t.TOUR_ERROR="$product_tour_error",t.TOUR_MATCHES_COUNT="$product_tour_matches_count",t.TOUR_FAILURE_PHASE="$product_tour_failure_phase",t.TOUR_WAITED_FOR_ELEMENT="$product_tour_waited_for_element",t.TOUR_WAIT_DURATION_MS="$product_tour_wait_duration_ms",t.TOUR_BANNER_SELECTOR="$product_tour_banner_selector",t.TOUR_LINKED_SURVEY_ID="$product_tour_linked_survey_id",t.USE_MANUAL_SELECTOR="$use_manual_selector",t.INFERENCE_DATA_PRESENT="$inference_data_present",t.TOUR_LAST_SEEN_DATE="$product_tour_last_seen_date",t.TOUR_TYPE="$product_tour_type",t}({}),jr=Si("[RateLimiter]");class Lr{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{jr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void jr.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(pe))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=a.tokens<1;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(pe,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()t(this.remoteConfig))):t()}ct(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:i=>{t(i.json)}})}load(){try{if(this.remoteConfig)return Nr.info("Using preloaded remote config",this.remoteConfig),this.ft(this.remoteConfig),void this._t();if(this._instance.bt())return void Nr.warn("Remote config is disabled. Falling back to local config.");this.vt((t=>{if(!t)return Nr.info("No config found after loading remote JS config. Falling back to JSON."),void this.ct((t=>{this.ft(t),this._t()}));this.ft(t),this._t()}))}catch(t){Nr.error("Error loading remote config",t)}}stop(){this.yt&&(clearInterval(this.yt),this.yt=void 0)}refresh(){this._instance.bt()||"hidden"===(null==o?void 0:o.visibilityState)||this._instance.reloadFeatureFlags()}_t(){var t;if(!this.yt){var i=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==i&&(this.yt=setInterval((()=>{this.refresh()}),i))}}ft(t){var i;(t||Nr.error("Failed to fetch remote config from PostHog."),this._instance.ft(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags))&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded())}}var Ur=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Hr=Uint8Array,Br=Uint16Array,qr=Uint32Array,Wr=new Hr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Gr=new Hr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Vr=new Hr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jr=function(t,i){for(var e=new Br(31),r=0;r<31;++r)e[r]=i+=1<>>1|(21845&ts)<<1;is=(61680&(is=(52428&is)>>>2|(13107&is)<<2))>>>4|(3855&is)<<4,Zr[ts]=((65280&is)>>>8|(255&is)<<8)>>>1}var es=function(t,i,e){for(var r=t.length,s=0,n=new Br(i);s>>l]=u}else for(o=new Br(r),s=0;s>>15-t[s];return o},rs=new Hr(288);for(ts=0;ts<144;++ts)rs[ts]=8;for(ts=144;ts<256;++ts)rs[ts]=9;for(ts=256;ts<280;++ts)rs[ts]=7;for(ts=280;ts<288;++ts)rs[ts]=8;var ss=new Hr(32);for(ts=0;ts<32;++ts)ss[ts]=5;var ns=es(rs,9,0),os=es(ss,5,0),as=function(t){return(t/8>>0)+(7&t&&1)},ls=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Br?Br:t instanceof qr?qr:Hr)(e-i);return r.set(t.subarray(i,e)),r},us=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8},hs=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8,t[r+2]|=e>>>16},ds=function(t,i){for(var e=[],r=0;rv&&(v=n[r].s);var c=new Br(v+1),f=vs(e[h-1],c,0);if(f>i){r=0;var p=0,_=f-i,g=1<<_;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));ri))break;p+=g-(1<>>=_;p>0;){var b=n[r].s;c[b]=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new Hr(c),f]},vs=function(t,i,e){return-1==t.s?Math.max(vs(t.l,i,e+1),vs(t.r,i,e+1)):i[t.s]=e},cs=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Br(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;a<=i;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},fs=function(t,i){for(var e=0,r=0;r>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;n4&&!P[Vr[I-1]];--I);var R,C,F,O,M=u+5<<3,A=fs(s,rs)+fs(n,ss)+o,D=fs(s,v)+fs(n,p)+o+14+3*I+fs(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(M<=A&&M<=D)return ps(i,h,t.subarray(l,l+u));if(us(i,h,1+(D15&&(us(i,h,z[S]>>>5&127),h+=z[S]>>>12)}}}else R=ns,C=rs,F=os,O=ss;for(S=0;S255){U=r[S]>>>18&31;hs(i,h,R[U+257]),h+=C[U+257],U>7&&(us(i,h,r[S]>>>23&31),h+=Wr[U]);var H=31&r[S];hs(i,h,F[H]),h+=O[H],H>3&&(hs(i,h,r[S]>>>5&8191),h+=Gr[H])}else hs(i,h,R[r[S]]),h+=C[r[S]];return hs(i,h,R[256]),h+C[256]},gs=new qr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ms=function(){for(var t=new qr(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),bs=function(t,i,e,r,s){return function(t,i,e,r,s,n){var o=t.length,a=new Hr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!i||o<8)for(var h=0;h<=o;h+=65535){var d=h+65535;d>>13,f=8191&v,p=(1<7e3||P>24576)&&O>423){u=_s(t,l,0,w,x,E,k,P,I,h-I,u),P=S=k=0,I=h;for(var M=0;M<286;++M)x[M]=0;for(M=0;M<30;++M)E[M]=0}var A=2,D=0,j=f,L=C-F&32767;if(O>2&&R==y(h-L))for(var N=Math.min(c,O)-1,z=Math.min(32767,h),U=Math.min(258,O);L<=z&&--j&&C!=F;){if(t[h+A]==t[h+A-L]){for(var H=0;HA){if(A=H,D=L,H>N)break;var B=Math.min(L,H-2),q=0;for(M=0;Mq&&(q=G,F=W)}}}L+=(C=F)-(F=_[C])+32768&32767}if(D){w[P++]=268435456|Xr[A]<<18|Qr[D];var V=31&Xr[A],J=31&Qr[D];k+=Wr[V]+Gr[J],++x[257+V],++E[J],T=h+A,++S}else w[P++]=t[h],++x[t[h]]}}u=_s(t,l,n,w,x,E,k,P,I,h-I,u)}return ls(a,0,r+as(u)+s)}(t,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,e,r,!0)},ys=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function ws(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p:function(i){for(var e=t,r=0;r>>8;t=e},d:function(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n=bs(t,i,10+((s=i).filename&&s.filename.length+1||0),8),o=n.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&ys(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}}(n,i),ys(n,o-8,e.d()),ys(n,o-4,r),n}var xs=function(t){var i,e,r,s,n="";for(i=e=0,r=(t=(t+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),D(a)||(e>i&&(n+=t.substring(i,e)),n+=a,i=e=s+1)}return e>i&&(n+=t.substring(i,t.length)),n},$s=!!u||!!l,Es=function(t,i,e){var r;void 0===e&&(e=!0);var[s,n]=t.split("?"),o=_({},i),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var i,[r,s]=t.split("="),n=e&&null!==(i=o[r])&&void 0!==i?i:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=ir(o);return l&&a.push(l),s+"?"+a.join("&")},Ss=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),ks=t=>{var{data:i,compression:e}=t;if(i){if(e===Ur.GZipJS){var r=ws(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Hr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;or.length){var a=new Hr(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return ls(r,0,s)}(Ss(i)),{mtime:0});return{contentType:"text/plain",body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Ur.Base64){var s=function(t){var i,e,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",h=[];if(!t)return t;t=xs(t);do{i=(n=t.charCodeAt(a++)<<16|t.charCodeAt(a++)<<8|t.charCodeAt(a++))>>18&63,e=n>>12&63,r=n>>6&63,s=63&n,h[l++]=o.charAt(i)+o.charAt(e)+o.charAt(r)+o.charAt(s)}while(a"data="+encodeURIComponent("string"==typeof t?t:Ss(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Ss(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Ps=[];l&&Ps.push({transport:"fetch",method:t=>{var i,e,{contentType:r,body:s,estimatedSize:n}=null!==(i=ks(t))&&void 0!==i?i:{},o=new Headers;Ri(t.headers,(function(t,i){o.append(i,t)})),r&&o.append("Content-Type",r);var a=t.url,u=null;if(h){var d=new h;u={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}l(a,_({method:(null==t?void 0:t.method)||"GET",headers:o,keepalive:"POST"===t.method&&(n||0)<52428.8,body:s,signal:null==(e=u)?void 0:e.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Ei.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{Ei.error(i),null==t.callback||t.callback({statusCode:0,error:i})})).finally((()=>u?clearTimeout(u.timeout):null))}}),u&&Ps.push({transport:"XHR",method:t=>{var i,e=new u;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=ks(t))&&void 0!==i?i:{};Ri(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(s)}}),null!=n&&n.sendBeacon&&Ps.push({transport:"sendBeacon",method:t=>{var i=Es(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=ks(t))&&void 0!==e?e:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(i,o)}catch(t){}}});var Ts=3e3;class Is{constructor(t,i){this.wt=!0,this.xt=[],this.$t=K((null==i?void 0:i.flush_interval_ms)||Ts,250,5e3,Ei.createLogger("flush interval"),Ts),this.Et=t}enqueue(t){this.xt.push(t),this.St||this.kt()}unload(){this.Pt();var t=this.xt.length>0?this.Tt():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Et(_({},t,{transport:"sendBeacon"}))}))}enable(){this.wt=!1,this.kt()}kt(){var t=this;this.wt||(this.St=setTimeout((()=>{if(this.Pt(),this.xt.length>0){var i=this.Tt(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&I(e.data)&&Ri(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Et(e)};for(var r in i)e()}}),this.$t))}Pt(){clearTimeout(this.St),this.St=void 0}Tt(){var t={};return Ri(this.xt,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;O(t[s])&&(t[s]=_({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.xt=[],t}}var Rs=["retriesPerformedSoFar"];class Cs{constructor(i){this.It=!1,this.Rt=3e3,this.xt=[],this._instance=i,this.xt=[],this.Ct=!0,!O(t)&&"onLine"in t.navigator&&(this.Ct=t.navigator.onLine,this.Ft=()=>{this.Ct=!0,this.Ot()},this.Mt=()=>{this.Ct=!1},Ui(t,"online",this.Ft),Ui(t,"offline",this.Mt))}get length(){return this.xt.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=g(t,Rs);N(i)&&(e.url=Es(e.url,{retry_count:i})),this._instance._send_request(_({},e,{callback:t=>{200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&(null!=i?i:0)<10?this.At(_({retriesPerformedSoFar:i},e)):null==e.callback||e.callback(t)}}))}At(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=(Math.random()-.5)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.xt.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Ei.warn(s),this.It||(this.It=!0,this.Dt())}Dt(){if(this.jt&&clearTimeout(this.jt),0===this.xt.length)return this.It=!1,void(this.jt=void 0);this.jt=setTimeout((()=>{this.Ct&&this.xt.length>0&&this.Ot(),this.Dt()}),this.Rt)}Ot(){var t=Date.now(),i=[],e=this.xt.filter((e=>e.retryAt0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:i}of(this.jt&&(clearTimeout(this.jt),this.jt=void 0),this.It=!1,O(t)||(this.Ft&&(t.removeEventListener("online",this.Ft),this.Ft=void 0),this.Mt&&(t.removeEventListener("offline",this.Mt),this.Mt=void 0)),this.xt))try{this._instance._send_request(_({},i,{transport:"sendBeacon"}))}catch(t){Ei.error(t)}this.xt=[]}}class Fs{constructor(t){this.Lt=()=>{var t,i,e,r;this.Nt||(this.Nt={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Nt.lastScrollY=Math.ceil(n),this.Nt.maxScrollY=Math.max(n,null!==(t=this.Nt.maxScrollY)&&void 0!==t?t:0),this.Nt.maxScrollHeight=Math.max(o,null!==(i=this.Nt.maxScrollHeight)&&void 0!==i?i:0),this.Nt.lastContentY=a,this.Nt.maxContentY=Math.max(a,null!==(e=this.Nt.maxContentY)&&void 0!==e?e:0),this.Nt.maxContentHeight=Math.max(l,null!==(r=this.Nt.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}getContext(){return this.Nt}resetContext(){var t=this.Nt;return setTimeout(this.Lt,0),t}startMeasuringScrollPosition(){Ui(t,"scroll",this.Lt,{capture:!0}),Ui(t,"scrollend",this.Lt,{capture:!0}),Ui(t,"resize",this.Lt)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==t?void 0:t.document.documentElement;var i=I(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var Os=t=>pr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class Ms{constructor(t,i,e,r){this.zt=t=>{var i=this.Ut();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Ht(this._instance)};this.Bt.register({[fe]:e})}},this._instance=t,this.qt=i,this.Bt=e,this.Ht=r||Os,this.qt.onSessionId(this.zt)}Ut(){return this.Bt.props[fe]}getSetOnceProps(){var t,i=null==(t=this.Ut())?void 0:t.props;return i?"r"in i?_r(i):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return Ri(Di(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+E(e)]=i})),t}}class As{constructor(){this.Wt={},this.Wt={}}on(t,i){return this.Wt[t]||(this.Wt[t]=[]),this.Wt[t].push(i),()=>{this.Wt[t]=this.Wt[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Wt[t]||[])e(i);for(var r of this.Wt["*"]||[])r(t,i)}}var Ds=Si("[SessionId]");class js{on(t,i){return this.Gt.on(t,i)}constructor(t,i,e){var r;if(this.Vt=[],this.Jt=void 0,this.Gt=new As,this.Kt=(t,i)=>!(!N(t)||!N(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.N=t.config,this.Bt=t.persistence,this.Yt=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Qt=i||Ie,this.Zt=e||Ie;var s=this.N.persistence_name||this.N.token,n=this.N.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*K(n,60,36e3,Ds.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ti(),this.ii="ph_"+s+"_window_id",this.ei="ph_"+s+"_primary_window_exists",this.ri()){var o=Ue.D(this.ii),a=Ue.D(this.ei);o&&!a?this.Yt=o:Ue.L(this.ii),Ue.j(this.ei,!0)}if(null!=(r=this.N.bootstrap)&&r.sessionID)try{var l=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(this.N.bootstrap.sessionID);this.si(this.N.bootstrap.sessionID,(new Date).getTime(),l)}catch(t){Ds.error("Invalid sessionID in bootstrap",t)}this.ni()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return O(this.Vt)&&(this.Vt=[]),this.Vt.push(t),this.Xt&&t(this.Xt,this.Yt),()=>{this.Vt=this.Vt.filter((i=>i!==t))}}ri(){return"memory"!==this.N.persistence&&!this.Bt.st&&Ue.O()}oi(t){t!==this.Yt&&(this.Yt=t,this.ri()&&Ue.j(this.ii,t))}ai(){return this.Yt?this.Yt:this.ri()?Ue.D(this.ii):null}si(t,i,e){t===this.Xt&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Xt=t,this.Bt.register({[ee]:[i,t,e]}))}li(){var t=this.Bt.props[ee];return I(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.si(null,null,null)}destroy(){clearTimeout(this.ui),this.ui=void 0,this.Jt&&t&&(t.removeEventListener("beforeunload",this.Jt,{capture:!1}),this.Jt=void 0),this.Vt=[]}ni(){this.Jt=()=>{this.ri()&&Ue.L(this.ei)},Ui(t,"beforeunload",this.Jt,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"always"===this.N.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.li(),o=this.ai(),a=N(n)&&Math.abs(e-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.Kt(e,r);u||h||a?(s=this.Qt(),o=this.Zt(),Ds.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.Zt(),l=!0);var d=!!N(r)&&t&&!a?r:e,v=!N(n)?(new Date).getTime():n;return this.oi(o),this.si(s,d,v),t||this.ti(),l&&this.Vt.forEach((t=>t(s,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}ti(){clearTimeout(this.ui),this.ui=setTimeout((()=>{var[t]=this.li();if(this.Kt((new Date).getTime(),t)){var i=this.Xt;this.resetSessionId(),this.Gt.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var Ls=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&y(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>y(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},Ns=function(t,i){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}};function zs(t,i,e){return Ss({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Us={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Ns(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Ns(i,t))))),icontains:(t,i)=>i.map(Hs).some((i=>t.map(Hs).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Hs).every((i=>t.map(Hs).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>et.toLowerCase();function Bs(t,i){return!t||Object.entries(t).every((t=>{var[e,r]=t,s=null==i?void 0:i[e];if(O(s)||D(s))return!1;var n=[String(s)],o=Us[r.operator];return!!o&&o(r.values,n)}))}var qs=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),Ws="i.posthog.com";class Gs{constructor(t){this.hi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Ws,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.hi[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hi[this.apiHost]=qs.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hi[this.apiHost]=qs.EU:this.hi[this.apiHost]=qs.CUSTOM),this.hi[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if("flags"===t)return this.flagsApiHost+i;if(this.region===qs.CUSTOM)return this.apiHost+i;var e=Ws+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var Vs=Si("[Surveys]");var Js="seenSurvey_",Ks=(t,i)=>{var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e},Ys=t=>((t,i)=>{var e=""+t+i.id;return i.current_iteration&&i.current_iteration>0&&(e=""+t+i.id+"_"+i.current_iteration),e})(Js,t),Xs=[Er,kr,Sr],Qs={ignoreConditions:!1,ignoreDelay:!1,displayType:Or},Zs=Si("[PostHog ExternalIntegrations]"),tn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class en{constructor(t){this._instance=t}V(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Zs.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;(!r||null!=(e=v.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.V(tn[i],(()=>{var e;null==(e=v.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i])&&(null==(n=v.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[i])||n.stop())};for(var[e,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;i(e)}}}var rn={},sn=0,nn=()=>{},on="posthog",an=!$s&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),ln=i=>{var e;return _({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ni(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:nn,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,debug:a&&M(null==a?void 0:a.search)&&-1!==a.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(e=t.location)?void 0:e.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;Ei.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Ts},error_tracking:{},_onCapture:nn,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(i))},un=t=>{var i={};O(t.process_person)||(i.person_profiles=t.process_person),O(t.xhr_headers)||(i.request_headers=t.xhr_headers),O(t.cookie_name)||(i.persistence_name=t.cookie_name),O(t.disable_cookie)||(i.disable_persistence=t.disable_cookie),O(t.store_google)||(i.save_campaign_params=t.store_google),O(t.verbose)||(i.debug=t.verbose);var e=Ci({},i,t);return I(t.property_blacklist)&&(O(t.property_denylist)?e.property_denylist=t.property_blacklist:I(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ei.error("Invalid value for property_denylist config: "+t.property_denylist)),e};class hn{constructor(){this.__forceAllowLocalhost=!1}get di(){return this.__forceAllowLocalhost}set di(t){Ei.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class dn{vi(t,i){if(t){var e=this.ci.indexOf(t);-1!==e&&this.ci.splice(e,1)}return this.ci.push(i),null==i.initialize||i.initialize(),i}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new hn,this.fi=!1,this.version=c.LIB_VERSION,this.pi=new As,this.ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ln(),this.SentryIntegration=Qe,this.sentryIntegration=t=>function(t,i){var e=Xe(t,i);return{name:Ye,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.gi=!1,this.mi=null,this.bi=null,this.yi=null,this.scrollManager=new Fs(this),this.pageViewManager=new Ze(this),this.rateLimiter=new Lr(this),this.requestRouter=new Gs(this),this.consent=new Be(this),this.externalIntegrations=new en(this);var i=null!==(t=dn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=M(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=M(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>Ei.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==on){var r,s=null!==(r=rn[e])&&void 0!==r?r:new dn;return s._init(t,i,e),rn[e]=s,rn[on][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s;if(void 0===e&&(e={}),O(i)||A(i))return Ei.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},e.debug=this.wi(e.debug),this.xi=e,this.$i=[],e.person_profiles?this.bi=e.person_profiles:e.process_person&&(this.bi=e.process_person),this.set_config(Ci({},ln(e.defaults),un(e),{name:r,token:i})),this.config.on_xhr_error&&Ei.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Ur.GZipJS;var n=this.Ei();this.persistence=new wr(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new wr(_({},this.config,{persistence:"sessionStorage"}),n);var o=_({},this.persistence.props),a=_({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Si=new Is((t=>this.ki(t)),this.config.request_queue_config),this.Pi=new Cs(this),this.__request_queue=[];var l="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new js(this),this.sessionPropsManager=new Ms(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ei.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ti(l)}),0)):(Ei.info("Initializing extensions synchronously"),this.Ti(l)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Ei.info("Starting in debug mode",{this:this,config:e,thisC:_({},this.config),p:o,s:a}),void 0!==(null==(s=e.bootstrap)?void 0:s.distinctID)){var u,h,d=this.config.get_device_id(Ie()),v=null!=(u=e.bootstrap)&&u.isIdentifiedID?d:e.bootstrap.distinctID;this.persistence.set_property(ce,null!=(h=e.bootstrap)&&h.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.bootstrap.distinctID,$device_id:v})}if(l)this.register_once({distinct_id:we,$device_id:null},"");else if(!this.get_distinct_id()){var f=this.config.get_device_id(Ie());this.register_once({distinct_id:f,$device_id:f},""),this.persistence.set_property(ce,"anonymous")}return Ui(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?Ke(this,(()=>this.Ii())):this.Ii(),R(this.config._onCapture)&&this.config._onCapture!==nn&&(Ei.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Ei.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Ti(t){var i,e,r,s,n,o,a,l=performance.now(),u=_({},dn.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.ci.push(this.featureFlags=null!==(i=this.featureFlags)&&void 0!==i?i:new u.featureFlags(this));u.exceptions&&this.ci.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new u.exceptions(this));(u.historyAutocapture&&this.ci.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.ci.push(new u.tracingHeaders(this)),u.siteApps&&this.ci.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.ci.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.ci.push(this.autocapture=new u.autocapture(this)),u.surveys)&&this.ci.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this));u.logs&&this.ci.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this));u.conversations&&this.ci.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new u.conversations(this));(u.productTours&&this.ci.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.ci.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.ci.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.ci.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.ci.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ge)),u.toolbar)&&this.ci.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this));u.experiments&&this.ci.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this));this.ci.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.push((()=>{if(this.Ri){var t=this.Ri;this.Ri=void 0,this.ft(t)}})),this.Ci(h,l)}Ci(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions)if(performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.Ci(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Ei.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&Ei.info("PostHog extensions initialized ("+r+"ms)")}ft(t){var i;if(!o||!o.body)return Ei.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.ft(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Ri=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=w(t.supportedCompression,Ur.GZipJS)?Ur.GZipJS:w(t.supportedCompression,Ur.Base64)?Ur.Base64:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.bi?this.bi:"identified_only"}),this.ci.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}Ii(){try{this.config.loaded(this)}catch(t){Ei.critical("`loaded` function failed",t)}if(this.Fi(),this.config.internal_or_test_user_hostname&&null!=a&&a.hostname){var t=a.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.Oi()}),1),this.Mi=new zr(this),this.Mi.load()}Fi(){var t;this.is_capturing()&&(this.config.request_batching&&(null==(t=this.Si)||t.enable()))}_dom_loaded(){this.is_capturing()&&Ii(this.__request_queue,(t=>this.ki(t))),this.__request_queue=[],this.Fi()}_handle_unload(){var t,i,e;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Ai()&&this.capture("$pageleave"),null==(i=this.Si)||i.unload(),null==(e=this.Pi)||e.unload()):this.Ai()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(an?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Es(t.url,{ip:this.config.ip?1:0}),t.headers=_({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,s=_({},t);s.timeout=s.timeout||6e4,s.url=Es(s.url,{_:(new Date).getTime().toString(),ver:c.LIB_VERSION,compression:s.compression});var n=null!==(i=s.transport)&&void 0!==i?i:"fetch",o=Ps.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(e=null==(r=zi(o,(t=>t.transport===n)))?void 0:r.method)&&void 0!==e?e:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(_({},t,{callback:i=>{var e,r;(this.rateLimiter.checkForLimiting(i),i.statusCode>=400)&&(null==(e=(r=this.config).on_request_error)||e.call(r,i));null==t.callback||t.callback(i)}}))))}ki(t){this.Pi?this.Pi.retriableRequest(t):this._send_request(t)}_execute_array(t){sn++;try{var i,e=[],r=[],s=[];Ii(t,(t=>{t&&(i=t[0],I(i)?s.push(t):R(t)?t.call(this):I(t)&&"alias"===i?e.push(t):I(t)&&-1!==i.indexOf("capture")&&R(this[i])?s.push(t):r.push(t))}));var n=function(t,i){Ii(t,(function(t){if(I(t[0])){var e=i;Ri(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else this[t[0]].apply(this,t.slice(1))}),i)};n(e,this),n(r,this),n(s,this)}finally{sn--}}push(t){if(sn>0&&I(t)&&M(t[0])){var i=dn.prototype[t[0]];R(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,e){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Si){if(this.is_capturing())if(!O(t)&&M(t)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var n=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=i&&i.$current_url&&!M(null==i?void 0:i.$current_url)&&(Ei.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=e&&e.Di||Ei.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,a=(null==e?void 0:e.timestamp)||o,l=Ie(),u={uuid:l,event:t,properties:this.calculateEventProperties(t,i||{},a,l)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),n&&(u.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==e?void 0:e.$set)&&(u.$set=null==e?void 0:e.$set);var h,d="$groupidentify"!==t,v=this.ji(null==e?void 0:e.$set_once,d);if(v&&(u.$set_once=v),(u=ji(u,null!=e&&e._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,O(null==e?void 0:e.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),t===Tr||t===Ir){var c=null==i?void 0:i[Rr],f=null==i?void 0:i[Cr];h={id:c,current_iteration:f},localStorage.getItem(Ys(h))||localStorage.setItem(Ys(h),"true"),u.$set=_({},u.$set,{[Ks({id:c,current_iteration:f},t===Ir?"responded":"dismissed")]:!0})}else t===Pr&&(u.$set=_({},u.$set,{[Fr]:(new Date).toISOString()}));if(t===Ar.SHOWN){var p=null==i?void 0:i[Dr.TOUR_TYPE];p&&(u.$set=_({},u.$set,{[Dr.TOUR_LAST_SEEN_DATE+"/"+p]:(new Date).toISOString()}))}var g=_({},u.properties.$set,u.$set);if(F(g)||this.setPersonPropertiesForFlags(g),!j(this.config.before_send)){var m=this.Li(u);if(!m)return;u=m}this.pi.emit("eventCaptured",u);var b={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:null==e?void 0:e._batchKey};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.ki(b):this.Si.enqueue(b),u}Ei.critical("This capture call is ignored due to client rate limiting.")}}else Ei.error("No event name provided to posthog.capture")}else Ei.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,e,r,s){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;var n=s?void 0:this.persistence.remove_event_timer(t),a=_({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),"$snapshot"===t){var l=_({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!M(a.distinct_id)&&!L(a.distinct_id)||A(a.distinct_id))&&Ei.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,h=br(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(s,e.getTime());a.$session_id=v,a.$window_id=c}this.sessionPropsManager&&Ci(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Ci(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(f=this.Pi)?void 0:f.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===qs.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u="$pageview"!==t||s?"$pageleave"!==t||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),a=Ci(a,u),"$pageview"===t&&o&&(a.title=o.title),!O(n)){var p=e.getTime()-n;a.$duration=parseFloat((p/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ci({},h,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),I(this.config.property_denylist)?Ri(this.config.property_denylist,(function(t){delete a[t]})):Ei.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(Ei.error("sanitize_properties is deprecated. Use before_send instead"),a=g(a,t));var m=this.Ni();return a.$process_person_profile=m,m&&!s&&this.zi("_calculate_event_properties"),a}ji(t,i){var e;if(void 0===i&&(i=!0),!this.persistence||!this.Ni())return t;if(this.fi)return t;var r=this.persistence.get_initial_props(),s=null==(e=this.sessionPropsManager)?void 0:e.getSetOnceProps(),n=Ci({},r,s||{},t||{}),o=this.config.sanitize_properties;return o&&(Ei.error("sanitize_properties is deprecated. Use before_send instead"),n=o(n,"$set_once")),i&&(this.fi=!0),F(n)?void 0:n}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i;null==(i=this.sessionPersistence)||i.register(t)}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t)}Ui(t,i){this.register({[t]:i})}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}isFeatureEnabled(t,i){var e;return null==(e=this.featureFlags)?void 0:e.isFeatureEnabled(t,i)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.pi.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:"Surveys module not available"}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:"Surveys module not available"})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:"Surveys module not available"})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=Qs),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:"Surveys module not available"}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:"Surveys module not available"})}identify(t,i,e){if(!this.__loaded||!this.persistence)return Ei.uninitializedWarning("posthog.identify");if(L(t)&&(t=t.toString(),Ei.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))Ei.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==we){if(this.zi("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==r&&t!==this.get_property(qi)&&(this.unregister(qi),this.register({distinct_id:t}));var n,o="anonymous"===(this.persistence.get_property(ce)||"anonymous");if(t!==r&&o)this.persistence.set_property(ce,"identified"),this.setPersonPropertiesForFlags(_({},e||{},i||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.yi=zs(t,i,e),null==(n=this.featureFlags)||n.setAnonymousDistinctId(r);else(i||e)&&this.setPersonProperties(i,e);t!==r&&(this.reloadFeatureFlags(),this.unregister(he))}}else Ei.critical('The string "'+we+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Ei.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,i){if((t||i)&&this.zi("posthog.setPersonProperties")){var e=zs(this.get_distinct_id(),t,i);this.yi!==e?(this.setPersonPropertiesForFlags(_({},i||{},t||{})),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.yi=e):Ei.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,e){if(t&&i){var r=this.getGroups();r[t]!==i&&this.resetGroupPropertiesForFlags(t),this.register({$groups:_({},r,{[t]:i})}),e&&(this.capture("$groupidentify",{$group_type:t,$group_key:i,$group_set:e}),this.setGroupPropertiesForFlags({[t]:e})),r[t]===i||e||this.reloadFeatureFlags()}else Ei.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.zi("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s,n,o,a;if(Ei.info("reset"),!this.__loaded)return Ei.uninitializedWarning("posthog.reset");var l=this.get_property("$device_id");if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Mi)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.persistence)||o.set_property(ce,"anonymous"),null==(a=this.sessionManager)||a.resetSessionId(),this.yi=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:we,$device_id:null},"");else{var u=this.config.get_device_id(Ie());this.register_once({distinct_id:u,$device_id:t?u:l},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(Bi)?(Ei.critical("Attempting to create alias for existing People user - aborting."),-2):this.zi("posthog.alias")?(O(i)&&(i=this.get_distinct_id()),t!==i?(this.Ui(qi,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Ei.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=_({},this.config);if(C(t)){var e,r,s,n,o,a,l,u,h;Ci(this.config,un(t));var d=this.Ei();null==(e=this.persistence)||e.update_config(this.config,i,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new wr(_({},this.config,{persistence:"sessionStorage"}),d);var v=this.wi(this.config.debug);z(v)&&(this.config.debug=v),z(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,De.O()&&De.j("ph_debug","true"),Ei.info("set_config",{config:t,oldConfig:i,newConfig:_({},this.config)})):(c.DEBUG=!1,De.O()&&De.L("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(u=this.surveys)||u.loadIfEnabled(),this.Hi(),null==(h=this.externalIntegrations)||h.startIfEnabledOrStop()}}startSessionRecording(t){var i=!0===t,e={sampling:i||!(null==t||!t.sampling),linked_flag:i||!(null==t||!t.linked_flag),url_trigger:i||!(null==t||!t.url_trigger),event_trigger:i||!(null==t||!t.event_trigger)};if(Object.values(e).some(Boolean)){var r,s,n,o,a;if(null==(r=this.sessionManager)||r.checkAndGetSessionAndWindowId(),e.sampling)null==(s=this.sessionRecording)||s.overrideSampling();if(e.linked_flag)null==(n=this.sessionRecording)||n.overrideLinkedFlag();if(e.url_trigger)null==(o=this.sessionRecording)||o.overrideTrigger("url");if(e.event_trigger)null==(a=this.sessionRecording)||a.overrideTrigger("event")}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){if(this.exceptions){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(_({},r,i))}}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:on;return i!==on&&(i=on+"."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property(ce))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property(ce))}Ni(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&F(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[qi])&&(null==(i=this.persistence)||null==(i=i.props)||!i[be]))}Ai(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Ni()||this.zi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.zi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}zi(t){return"never"===this.config.person_profiles?(Ei.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ui(be,!0),!0)}Ei(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut(),i=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||t&&!!i}Hi(){var t,i,e,r,s=this.Ei();(null==(t=this.persistence)?void 0:t.st)!==s&&(null==(e=this.persistence)||e.set_disabled(s));(null==(i=this.sessionPersistence)?void 0:i.st)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()){var e,r,s,n,o;this.reset(!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new js(this),this.pageViewManager=new Ze(this),this.persistence&&(this.sessionPropsManager=new Ms(this,this.sessionManager,this.persistence));var a=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=dn.__defaultExtensionClasses)?void 0:o.sessionRecording;a&&(this.sessionRecording=this.vi(this.sessionRecording,new a(this)))}var l,u;if(this.consent.optInOut(!0),this.Hi(),this.Fi(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode)null==(l=this.surveys)||l.loadIfEnabled();if(O(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this.Oi()}else Ei.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t,i,e;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Hi(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:we,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,this.Oi())):Ei.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===He.GRANTED?"granted":t===He.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Hi()}_is_bot(){return n?Ls(n,this.config.custom_blocked_useragents):void 0}Oi(){o&&("visible"===o.visibilityState?this.gi||(this.gi=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}),this.mi&&(o.removeEventListener("visibilitychange",this.mi),this.mi=null)):this.mi||(this.mi=this.Oi.bind(this),Ui(o,"visibilitychange",this.mi)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}bt(){var t,i,e,r,s,n,o,a=this.xi||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ei.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(e="advanced_disable_decide",r=!1,s=Ei,n=(i="advanced_disable_flags")in(t=a)&&!j(t[i]),o=e in t&&!j(t[e]),n?t[i]:o?(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]):r)}Li(t){if(j(this.config.before_send))return t;var i=I(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),j(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return H(t.event)?Ei.warn(s+". This can cause unexpected behavior."):Ei.info(s),null}e.properties&&!F(e.properties)||Ei.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return e}getPageViewId(){var t;return null==(t=this.pageViewManager.Y)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}wi(t){var i=z(t)&&!t,e=De.O()&&"true"===De.A("ph_debug");return!i&&(!!e||t)}}dn.__defaultExtensionClasses={},function(t,i){for(var e=0;ee.match(t))))}function bn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return gn(i)}function yn(t){return j(t)?null:x(t).split(/(\s+)/).filter((t=>Un(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function wn(t){var i="";return On(t)&&!Mn(t)&&t.childNodes&&t.childNodes.length&&Ri(t.childNodes,(function(t){var e;pn(t)&&t.textContent&&(i+=null!==(e=yn(t.textContent))&&void 0!==e?e:"")})),x(i)}function xn(t){return O(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}var $n=["a","button","form","input","select","textarea","label"];function En(t,i){if(O(i))return!0;var e,r=function(t){if(i.some((i=>t.matches(i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function Sn(t){var i=t.parentNode;return!(!i||!cn(i))&&i}var kn=["next","previous","prev",">","<"],Pn=10;var Tn=[".ph-no-rageclick",".ph-no-capture"];function In(i,e){if(!t||Rn(i))return!1;var r,s,n;z(e)?(r=!!e&&Tn,s=void 0):(r=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:Tn,s=null==e?void 0:e.content_ignorelist);if(!1===r)return!1;var{targetElementList:o}=Cn(i,!1);return!function(t,i){if(!1===t||O(t))return!1;var e;if(!0===t)e=kn;else{if(!I(t))return!1;if(t.length>Pn)return Ei.error("[PostHog] content_ignorelist array cannot exceed "+Pn+" items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var{safeText:i,ariaLabel:r}=t;return e.some((t=>i.includes(t)||r.includes(t)))}))}(s,o.map((t=>{var i;return{safeText:wn(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!En(o,r)}var Rn=t=>!t||fn(t,"html")||!cn(t),Cn=(i,e)=>{if(!t||Rn(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!fn(n,"body");)if(_n(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Sn(n);if(!o)break;if(e||$n.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function Fn(i,e,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||Rn(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!mn(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&mn(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:d,targetElementList:v}=Cn(i,s);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(O(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,r))return!1;if(!En(v,null==(u=r)?void 0:u.css_selector_allowlist))return!1;var c=t.getComputedStyle(i);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===e.type)return!0;var f=i.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return d?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&($n.indexOf(f)>-1||"true"===i.getAttribute("contenteditable"))}}function On(t){for(var i=t;i.parentNode&&!fn(i,"body");i=i.parentNode){var e=bn(i);if(w(e,"ph-sensitive")||w(e,"ph-no-capture"))return!1}if(w(bn(t),"ph-include"))return!0;var r=t.type||"";if(M(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";if(M(s)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Mn(t){return!!(fn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||fn(t,"select")||fn(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var An="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Dn=new RegExp("^(?:"+An+")$"),jn=new RegExp(An),Ln="\\d{3}-?\\d{2}-?\\d{4}",Nn=new RegExp("^("+Ln+")$"),zn=new RegExp("("+Ln+")");function Un(t,i){if(void 0===i&&(i=!0),j(t))return!1;if(M(t)){if(t=x(t),(i?Dn:jn).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Nn:zn).test(t))return!1}return!0}function Hn(t){var i=wn(t);return Un(i=(i+" "+Bn(t)).trim())?i:""}function Bn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Ri(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=wn(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Bn(t)).trim())}catch(t){Ei.error("[AutoCapture]",t)}})),i}function qn(t){return function(t){var i=t.map((t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=_({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Oi(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[Wn(i.toString())]=Wn(e.toString())})),r+=":",r+=Oi(o).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")}));return i.join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Gn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Oi(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(t))}function Wn(t){return t.replace(/"|\\"/g,'\\"')}function Gn(t){var i=t.attr__class;return i?I(i)?i:gn(i):void 0}class Vn{constructor(t){this.disabled=!1===t;var i=C(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)t?i.slice(0,t)+"...":i}function Xn(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!cn(i));return i}function Qn(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};$n.indexOf(s)>-1&&!e&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=Yn(1024,Hn(t)):n.$el_text=Yn(1024,wn(t)));var o=bn(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Ri(t.attributes,(function(e){var s;if((!Mn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&((null==r||!r.includes(e.name))&&!i&&Un(e.value)&&(s=e.name,!M(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=e.value;"class"===e.name&&(o=gn(o).join(" ")),n["attr__"+e.name]=Yn(1024,o)}}));for(var a=1,l=1,u=t;u=Xn(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function Zn(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e,h=[i],d=i;d.parentNode&&!fn(d,"body");)_n(d.parentNode)?(h.push(d.parentNode.host),d=d.parentNode.host):(h.push(d.parentNode),d=d.parentNode);var v,c=[],f={},p=!1,_=!1;if(Ri(h,(t=>{var i=On(t);"a"===t.tagName.toLowerCase()&&(p=t.getAttribute("href"),p=i&&p&&Un(p)&&p),w(bn(t),"ph-no-capture")&&(_=!0),c.push(Qn(t,o,a,l));var e=function(t){if(!On(t))return{};var i={};return Ri(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Un(r)&&(i[e]=r)}})),i}(t);Ci(f,e)})),_)return{props:{},explicitNoCapture:_};if(a||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?c[0].$el_text=Hn(i):c[0].$el_text=wn(i)),p){var g,m;c[0].attr__href=p;var b=null==(g=tr(p))?void 0:g.host,y=null==t||null==(m=t.location)?void 0:m.host;b&&y&&b!==y&&(v=p)}return{props:Ci({$event_type:n.type,$ce_version:1},u?{}:{$elements:c},{$elements_chain:qn(c)},null!=(r=c[0])&&r.$el_text?{$el_text:null==(s=c[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},f)}}var to=Si("[ExceptionAutocapture]");function io(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return R(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}var eo=Si("[TracingHeaders]");var ro=Si("[Web Vitals]"),so=9e5;var no="disabled",oo="lazy_loading",ao="awaiting_config",lo="missing_config";Si("[SessionRecording]");var uo="[SessionRecording]",ho=Si(uo);var vo=Si("[Heatmaps]");function co(t){return C(t)&&"clientX"in t&&"clientY"in t&&L(t.clientX)&&L(t.clientY)}var fo=Si("[Product Tours]"),po="ph_product_tours";var _o=["$set_once","$set"],go=Si("[SiteApps]");function mo(t,i,e){if(j(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class bo{constructor(t){this.Bi=new As,this.qi=(t,i)=>this.Wi(t,i)&&this.Gi(t,i)&&this.Vi(t,i)&&this.Ji(t,i),this.Wi=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.Ki=new Set,this.Yi=new Set}init(){var t;if(!O(null==(t=this._instance)?void 0:t._addCaptureHook)){var i;null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.on(t,i)}))}}register(t){var i,e;if(!O(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i,e;null==(i=this.Yi)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.Ki)||i.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r,s=new Set;t.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,i){var e;null!=i&&0!=t.length&&(this.Ki.has(t)||this.Ki.has(null==i?void 0:i.event))&&this.Yi&&(null==(e=this.Yi)?void 0:e.size)>0&&this.Yi.forEach((t=>{this.Xi(i,t)&&this.Bi.emit("actionCaptured",t.name)}))}Qi(t){this.onAction("actionCaptured",(i=>t(i)))}Xi(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.qi(t,e))return!0;return!1}onAction(t,i){return this.Bi.on(t,i)}Gi(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!mo(r,i.url,i.url_matching||"contains"))return!1}return!0}Vi(t,i){return!!this.Zi(t,i)&&(!!this.te(t,i)&&!!this.ie(t,i))}Zi(t,i){var e;if(null==i||!i.href)return!0;var r=this.ee(t);if(r.length>0)return r.some((t=>mo(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&mo((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}te(t,i){var e;if(null==i||!i.text)return!0;var r=this.ee(t);if(r.length>0)return r.some((t=>mo(t.text,i.text,i.text_matching||"exact")||mo(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!j(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>mo(t,n,o))))}ie(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}ee(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Ji(t,i){return null==i||!i.properties||0===i.properties.length||Bs(i.properties.reduce(((t,i)=>{var e=I(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class yo{constructor(t){this._instance=t,this.re=new Map,this.se=new Map,this.ne=new Map}oe(t,i){return!!t&&Bs(t.propertyFilters,null==i?void 0:i.properties)}ae(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}le(t,i,e){var r=(e===xr?this.re:this.se).get(t),s=[];return this.ue((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.oe(n,i)}))}register(t){var i;O(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.he(t),this.de(t))}de(t){var i=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.actions)&&(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length)>0}));if(0!==i.length){if(null==this.ve){this.ve=new bo(this._instance),this.ve.init();this.ve.Qi((t=>{this.onAction(t)}))}i.forEach((t=>{var i,e,r,s,n;t.conditions&&null!=(i=t.conditions)&&i.actions&&null!=(e=t.conditions)&&null!=(e=e.actions)&&e.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.ve)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((i=>{if(i&&i.name){var e=this.ne.get(i.name);e&&e.push(t.id),this.ne.set(i.name,e||[t.id])}})))}))}}he(t){var i,e=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),r=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}));if(0!==e.length||0!==r.length){null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.onEvent(t,i)})),this.re=this.ae(t,xr),this.se=this.ae(t,$r)}}onEvent(t,i){var e,r=this.ce(),s=this.fe(),n=this.pe(),o=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[s])||[];if(n===t&&i&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:i,existingActivatedItems:o});var u=(null==i||null==(a=i.properties)?void 0:a.$survey_id)||(null==i||null==(l=i.properties)?void 0:l.$product_tour_id);if(u){var h=o.indexOf(u);h>=0&&(o.splice(h,1),this._e(o))}}else{if(this.se.has(t)){var d=this.le(t,i,$r);d.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((t=>t.id))}),d.forEach((t=>{var i=o.indexOf(t.id);i>=0&&o.splice(i,1),this.ge(t.id)})),this._e(o))}if(this.re.has(t)){r.info("event name matched",{event:t,eventPayload:i,items:this.re.get(t)});var v=this.le(t,i,xr);this._e(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var i,e=this.fe(),r=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[e])||[];this.ne.has(t)&&this._e(r.concat(this.ne.get(t)||[]))}_e(t){var i,e=this.ce(),r=this.fe(),s=[...new Set(t)].filter((t=>!this.me(t)));e.info("updating activated items",{activatedItems:s}),null==(i=this._instance)||null==(i=i.persistence)||i.register({[r]:s})}getActivatedIds(){var t,i=this.fe(),e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e||[]}getEventToItemsMap(){return this.re}be(){return this.ve}}class wo extends yo{constructor(t){super(t)}fe(){return"$surveys_activated"}pe(){return Pr}ue(t){var i;null==(i=this._instance)||i.getSurveys(t)}ge(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}ce(){return Vs}me(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var xo=null!=t&&t.location?sr(t.location.hash,"__posthog")||sr(location.hash,"state"):null,$o="_postHogToolbarParams",Eo=Si("[Toolbar]"),So=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(So||{});var ko=Si("[FeatureFlags]"),Po=Si("[FeatureFlags]",{debugEnabled:!0}),To="errors_while_computing_flags",Io="flag_missing",Ro="quota_limited",Co="timeout",Fo="connection_error",Oo="unknown_error",Mo=t=>"api_error_"+t,Ao="$active_feature_flags",Do="$override_feature_flags",jo="$feature_flag_payloads",Lo="$override_feature_flag_payloads",No="$feature_flag_request_id",zo=t=>{var i={};for(var[e,r]of Oi(t||{}))r&&(i[e]=r);return i},Uo=t=>{var i=t.flags;return i?(t.featureFlags=Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[t].metadata)?void 0:e.payload]})))):ko.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},Ho=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});var Bo=Si("[Error tracking]");var qo={icontains:(i,e)=>!!t&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!t&&-1===e.href.toLowerCase().indexOf(i.toLowerCase()),regex:(i,e)=>!!t&&Ns(e.href,i),not_regex:(i,e)=>!!t&&!Ns(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class Wo{constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Wo.ye("retrieved web experiments from the server"),i.we=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;if(i.we)Wo.ye("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.we)||e.set(t.feature_flag_key,t);var r=i._instance.getFeatureFlag(t.feature_flag_key);M(r)&&t.variants[r]&&i.xe(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Wo.$e(n)&&i.xe(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Wo.ye("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(j(this.we))return this.we=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Wo.ye("applying feature flags",t),t.forEach((t=>{var i;if(this.we&&null!=(i=this.we)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.we)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.xe(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Wo.getWindowLocation();if(null!=t&&t.search){var i=er(null==t?void 0:t.search,"__experiment_id"),e=er(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Wo.ye("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Ee(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._instance.config.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:i=>{if(200!==i.statusCode||!i.json)return t([]);var e=i.json.experiments||[];return t(e)}})}Ee(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Wo.ye("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.xe(r[0].name,i,r[0].variants[i].transforms))}static $e(t){return!j(t.conditions)&&(Wo.Se(t)&&Wo.ke(t))}static Se(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=Wo.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||qo[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static ke(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.utm))return!0;var e=hr();if(e.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static ye(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r{if(e.selector){var r;Wo.ye("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):Wo.ye("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?Ls(n,this._instance.config.custom_blocked_useragents):void 0}}var Go=Si("[Conversations]");var Vo,Jo,Ko={featureFlags:class{constructor(t){this.Pe=!1,this.Te=!1,this.Ie=!1,this.Re=!1,this.Ce=!1,this.Fe=!1,this.Oe=!1,this.Me=!1,this._instance=t,this.featureFlagEventHandlers=[]}Ae(){var t,i;return null!==(t=null==(i=this._instance.persistence)?void 0:i.nt(this._instance.config.feature_flag_cache_ttl_ms))&&void 0!==t&&t}De(){return!!this.Ae()&&(this.Me||this.Ie||(this.Me=!0,ko.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}je(){var t,i=null!==(t=this._instance.config.evaluation_contexts)&&void 0!==t?t:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.Oe||(ko.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Oe=!0),null!=i&&i.length?i.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||ko.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Le(){return this.je().length>0}initialize(){var t,i,{config:e}=this._instance,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(o[i]&&(t[i]=o[i]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,e){var r=null!=e&&e.merge?this.getFlagVariants():{},s=null!=e&&e.merge?this.getFlagPayloads():{},n=_({},r,t),o=_({},s,i),a={};for(var[l,u]of Object.entries(n)){var h="string"==typeof u;a[l]={key:l,enabled:!!h||Boolean(u),variant:h?u:void 0,reason:void 0,metadata:O(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Te}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(oe),i=this._instance.get_property(Do),e=this._instance.get_property(Lo);if(!e&&!i)return t||{};var r=Ci({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],u=null==i?void 0:i[n],h=O(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=O(u)?l.variant:"string"==typeof u?u:void 0,v=null==e?void 0:e[n],c=_({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});if(h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v)c.metadata=_({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload});r[n]=c}return this.Pe||(ko.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.Pe=!0),r}getFlagVariants(){var t=this._instance.get_property(se),i=this._instance.get_property(Do);if(!i)return t||{};for(var e=Ci({},t),r=Object.keys(i),s=0;s{this.ze()}),5))}Ue(){clearTimeout(this.Ne),this.Ne=void 0}ensureFlagsLoaded(){this.Te||this.Ie||this.Ne||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Re=t}ze(t){var i;if(this.Ue(),!this._instance.bt())if(this.Ie)this.Ce=!0;else{var e=this._instance.config.token,r=this._instance.get_property("$device_id"),s={token:e,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:_({},(null==(i=this._instance.persistence)?void 0:i.get_initial_props())||{},this._instance.get_property(ae)||{}),group_properties:this._instance.get_property(le),timezone:gr()};D(r)||O(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Le()&&(s.evaluation_contexts=this.je());var n=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+n);this.Ie=!0,this._instance._send_request({method:"POST",url:o,data:s,compression:this._instance.config.disable_compression?void 0:Ur.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:t=>{var i,e,r,n=!0;if(200===t.statusCode&&(this.Ce||(this.$anon_distinct_id=void 0),n=!1),this.Ie=!1,!s.disable_flags||this.Ce){this.Fe=!n;var o=[];t.error?t.error instanceof Error?o.push("AbortError"===t.error.name?Co:Fo):o.push(Oo):200!==t.statusCode&&o.push(Mo(t.statusCode)),null!=(i=t.json)&&i.errorsWhileComputingFlags&&o.push(To);var a=!(null==(e=t.json)||null==(e=e.quotaLimited)||!e.includes(Ho.FeatureFlags));if(a&&o.push(Ro),null==(r=this._instance.persistence)||r.register({[de]:o}),a)ko.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var l;if(!s.disable_flags)this.receivedFeatureFlags(null!==(l=t.json)&&void 0!==l?l:{},n);this.Ce&&(this.Ce=!1,this.ze())}}}})}}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.Fe)if(this.Te||this.getFlags()&&this.getFlags().length>0){if(!this.De()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else ko.warn('getFeatureFlag for key "'+t+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.Fe)if(this.Te||this.getFlags()&&this.getFlags().length>0){if(!this.De()){var e=this.getFlagVariants(),r=t in e,s=e[t],n=this.getFlagPayloads()[t],o=String(s),a=this._instance.get_property(No)||void 0,l=this._instance.get_property(ve)||void 0,u=this._instance.get_property(he)||{};if((i.send_event||!("send_event"in i))&&(!(t in u)||!u[t].includes(o))){var h,d,v,c,f,p,_,g,m,b;I(u[t])?u[t].push(o):u[t]=[o],null==(h=this._instance.persistence)||h.register({[he]:u});var y=this.getFeatureFlagDetails(t),w=[...null!==(d=this._instance.get_property(de))&&void 0!==d?d:[]];O(s)&&w.push(Io);var x={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(v=this._instance.config.bootstrap)||null==(v=v.featureFlags)?void 0:v[t])||null,$feature_flag_bootstrapped_payload:(null==(c=this._instance.config.bootstrap)||null==(c=c.featureFlagPayloads)?void 0:c[t])||null,$used_bootstrap_value:!this.Fe};O(null==y||null==(f=y.metadata)?void 0:f.version)||(x.$feature_flag_version=y.metadata.version);var E,S=null!==(p=null==y||null==(_=y.reason)?void 0:_.description)&&void 0!==p?p:null==y||null==(g=y.reason)?void 0:g.code;if(S&&(x.$feature_flag_reason=S),null!=y&&null!=(m=y.metadata)&&m.id&&(x.$feature_flag_id=y.metadata.id),O(null==y?void 0:y.original_variant)&&O(null==y?void 0:y.original_enabled)||(x.$feature_flag_original_response=O(y.original_variant)?y.original_enabled:y.original_variant),null!=y&&null!=(b=y.metadata)&&b.original_payload)x.$feature_flag_original_payload=null==y||null==(E=y.metadata)?void 0:E.original_payload;w.length&&(x.$feature_flag_error=w.join(",")),this._instance.capture("$feature_flag_called",x)}if(r){var k=n;if(!O(n))try{k=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:k}}}}else ko.warn('getFeatureFlagResult for key "'+t+"\" failed. Feature flags didn't load in time.")}getRemoteConfigPayload(t,i){var e=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.Le()&&(r.evaluation_contexts=this.je()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this._instance.config.disable_compression?void 0:Ur.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var r,s=null==(r=e.json)?void 0:r.featureFlagPayloads;i((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,i){if(void 0===i&&(i={}),!i.fresh||this.Fe){if(this.Te||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return O(e)?void 0:!!e}ko.warn('isFeatureEnabled for key "'+t+"\" failed. Feature flags didn't load in time.")}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this._instance.persistence){this.Te=!0;var e=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(t,i,e,r,s){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={});var n=Uo(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var u=t.requestId,h=t.evaluatedAt;if(I(a)){ko.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(a)for(var v=0;v{var i;return!(null!=(i=o[t])&&i.failed)})));c=_({},e,Object.fromEntries(Object.entries(c).filter((t=>{var[i]=t;return g.has(i)})))),f=_({},r,Object.fromEntries(Object.entries(f||{}).filter((t=>{var[i]=t;return g.has(i)})))),p=_({},s,Object.fromEntries(Object.entries(p||{}).filter((t=>{var[i]=t;return g.has(i)}))))}else c=_({},e,c),f=_({},r,f),p=_({},s,p);i&&i.register(_({[Ao]:Object.keys(zo(c)),[se]:c||{},[jo]:f||{},[oe]:p||{}},u?{[No]:u}:{},h?{[ve]:h}:{}))}}}(t,this._instance.persistence,e,r,s),i||(this.Me=!1),this.He(i)}}override(t,i){void 0===i&&(i=!1),ko.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return ko.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this._instance.persistence.unregister(Do),this._instance.persistence.unregister(Lo),this.He(),Po.info("All overrides cleared");if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;if(this.Pe=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i),"flags"in e)if(!1===e.flags)this._instance.persistence.unregister(Do),Po.info("Flag overrides cleared");else if(e.flags){if(I(e.flags)){for(var r={},s=0;sthis.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this._instance.get_property(ne)||[]).find((i=>i.flagKey===t)),n={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:n};s&&(o.$early_access_feature_name=s.name),e&&(o.$feature_enrollment_stage=e),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=_({},this.getFlagVariants(),{[t]:i});null==(r=this._instance.persistence)||r.register({[Ao]:Object.keys(zo(a)),[se]:a}),this.He()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this._instance.get_property(ne),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this._instance.persistence)||e.unregister(ne),null==(r=this._instance.persistence)||r.register({[ne]:s}),t(s)}}})}Be(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}He(t){var{flags:i,flagVariants:e}=this.Be();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(ae)||{};this._instance.register({[ae]:_({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ae)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(le)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=_({},e[i],t[i]),delete t[i]})),this._instance.register({[le]:_({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this._instance.get_property(le)||{};this._instance.register({[le]:_({},i,{[t]:{}})})}else this._instance.unregister(le)}reset(){this.Te=!1,this.Ie=!1,this.Re=!1,this.Ce=!1,this.Fe=!1,this.$anon_distinct_id=void 0,this.Ue(),this.Pe=!1}}},Yo={sessionRecording:class{get started(){var t;return!(null==(t=this.qe)||!t.isStarted)}get status(){var t,i;return this.We===ao||this.We===lo?this.We:null!==(t=null==(i=this.qe)?void 0:i.status)&&void 0!==t?t:this.We}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.We=no,this.Ge=void 0,this._instance=t,!this._instance.sessionManager)throw ho.error("started without valid sessionManager"),new Error(uo+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(uo+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ve(){var i,e=!(null==(i=this._instance.get_property(ie))||!i.enabled),r=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!this.Ve||null==(i=this.qe)||!i.isStarted){var e=!O(Object.assign)&&!O(Array.from);this.Ve&&e?(this.Je(t),ho.info("starting")):(this.We=no,this.stopRecording())}}Je(t){var i,e,r;this.Ve&&(this.We!==ao&&this.We!==lo&&(this.We=oo),null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.Ke(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Ye,(i=>{if(i)return ho.error("could not load recorder",i);this.Ke(t)})))}stopRecording(){var t,i;null==(t=this.Ge)||t.call(this),this.Ge=void 0,null==(i=this.qe)||i.stop()}Xe(){var t,i;null==(t=this.Ge)||t.call(this),this.Ge=void 0,null==(i=this.qe)||i.discard()}Qe(){var t;null==(t=this._instance.persistence)||t.unregister(re)}Ze(t,i){if(j(t))return null;var e,r=L(t)?t:parseFloat(t);return"number"==typeof(e=r)&&Number.isFinite(e)&&e>=0&&e<=1?r:(ho.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null)}tr(t){if(this._instance.persistence){var i,e,r=this._instance.persistence,s=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Ze(null==(i=this._instance.config.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),n=this.Ze(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=s?s:n;j(o)&&this.Qe();var a=null==e?void 0:e.minimumDurationMilliseconds;r.register({[ie]:_({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:_({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:O(a)?null:a,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers})})};s(),null==(i=this.Ge)||i.call(this),this.Ge=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.tr(t),void this.Xe()):(this.tr(t),void this.startIfEnabledOrStop()):(this.We===ao&&(this.We=lo,ho.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.qe)&&e.log?this.qe.log(t,i):ho.warn("log called before recorder was ready")}get Ye(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ie);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}ir(){var t,i=this._instance.get_property(ie);if(!i)return!1;var e=null!==(t=("object"==typeof i?i:JSON.parse(i)).cache_timestamp)&&void 0!==t?t:Date.now();return Date.now()-e<=36e5}Ke(t){var i,e;if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.qe||(this.qe=null==(e=v.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.qe._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture);if(!this.ir()){if(this.We===lo||this.We===ao)return;return this.We=ao,ho.info("persisted remote config is stale, requesting fresh config before starting"),void new zr(this._instance).load()}this.We=oo,this.qe.start(t)}onRRwebEmit(t){var i;null==(i=this.qe)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.qe||(null==(i=this._instance.persistence)||i.register({$replay_override_linked_flag:!0}));null==(t=this.qe)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.qe||(null==(i=this._instance.persistence)||i.register({$replay_override_sampling:!0}));null==(t=this.qe)||t.overrideSampling()}overrideTrigger(t){var i,e;this.qe||(null==(e=this._instance.persistence)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}));null==(i=this.qe)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.qe)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.qe)||!e.tryAddCustomEvent(t,i))}}},Xo={autocapture:class{constructor(t){this.er=!1,this.rr=null,this.sr=!1,this.instance=t,this.rageclicks=new Vn(t.config.rageclick),this.nr=null}initialize(){this.startIfEnabled()}get N(){var t,i,e=C(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=null==(t=e.url_allowlist)?void 0:t.map((t=>new RegExp(t))),e.url_ignorelist=null==(i=e.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),e}ar(){if(this.isBrowserSupported()){if(t&&o){var i=i=>{i=i||(null==t?void 0:t.event);try{this.lr(i)}catch(t){Kn.error("Failed to capture event",t)}};if(Ui(o,"submit",i,{capture:!0}),Ui(o,"change",i,{capture:!0}),Ui(o,"click",i,{capture:!0}),this.N.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.lr(i,Jn)};Ui(o,"copy",e,{capture:!0}),Ui(o,"cut",e,{capture:!0})}}}else Kn.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.er&&(this.ar(),this.er=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.sr=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Gi]:!!t.autocapture_opt_out}),this.rr=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.nr=t}getElementSelectors(t){var i,e=[];return null==(i=this.nr)||i.forEach((i=>{var r=null==o?void 0:o.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[Gi],r=this.rr;if(D(r)&&!z(e)&&!this.instance.bt())return!1;var s=null!==(i=this.rr)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!s}lr(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=xn(i);if(pn(s)&&(s=s.parentNode||null),"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent)this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(i.clientX,i.clientY,i.timeStamp||(new Date).getTime())&&In(s,this.instance.config.rageclick)&&this.lr(i,"$rageclick");var n=e===Jn;if(s&&Fn(s,i,this.N,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=Zn(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.N.element_attribute_ignorelist,elementsChainAsString:this.sr});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===Jn){var u,h=yn(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=i.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=d}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return R(null==o?void 0:o.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.ur=(null==t||null==(e=t.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Ei.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.hr&&this.hr(),this.hr=void 0,Ei.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||io(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r.dr("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||io(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r.dr("replaceState")})),this.vr()}}dr(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this.ur&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this.ur=r}catch(t){Ei.error("Error capturing "+i+" pageview",t)}}vr(){if(!this.hr){var i=()=>{this.dr("popstate")};Ui(t,"popstate",i),this.hr=()=>{t&&t.removeEventListener("popstate",i)}}}},heatmaps:class{constructor(t){var i;this.cr=!1,this.er=!1,this.pr=null,this.instance=t,this.cr=!(null==(i=this.instance.persistence)||!i.props[Vi]),this.rageclicks=new Vn(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return C(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return j(this.instance.config.capture_heatmaps)?j(this.instance.config.enable_heatmaps)?this.cr:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.er)return;vo.info("starting..."),this._r(),this.gr()}else{var t;clearInterval(null!==(t=this.pr)&&void 0!==t?t:void 0),this.mr(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Vi]:i}),this.cr=i,this.startIfEnabled()}}getAndClearBuffer(){var t=this.C;return this.C=void 0,t}br(t){this.yr(t.originalEvent,"deadclick")}gr(){this.pr&&clearInterval(this.pr),this.pr=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(o)?setInterval(this.Ot.bind(this),this.flushIntervalMilliseconds):null}_r(){t&&o&&(this.wr=this.Ot.bind(this),Ui(t,"beforeunload",this.wr),this.$r=i=>this.yr(i||(null==t?void 0:t.event)),Ui(o,"click",this.$r,{capture:!0}),this.Er=i=>this.Sr(i||(null==t?void 0:t.event)),Ui(o,"mousemove",this.Er,{capture:!0}),this.kr=new Ve(this.instance,We,this.br.bind(this)),this.kr.startIfEnabledOrStop(),this.Pr=this.gr.bind(this),Ui(o,"visibilitychange",this.Pr),this.er=!0)}mr(){var i;t&&o&&(this.wr&&t.removeEventListener("beforeunload",this.wr),this.$r&&o.removeEventListener("click",this.$r,{capture:!0}),this.Er&&o.removeEventListener("mousemove",this.Er,{capture:!0}),this.Pr&&o.removeEventListener("visibilitychange",this.Pr),clearTimeout(this.Tr),null==(i=this.kr)||i.stop(),this.er=!1)}Ir(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&cn(s)&&!fn(s,"body");){if(s===r)return!1;if(w(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=Sn(s)}return!1}(xn(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}yr(t,i){var e;if(void 0===i&&(i="click"),!vn(t.target)&&co(t)){var r=this.Ir(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Rr(_({},r,{type:"rageclick"})),this.Rr(r)}}Sr(t){!vn(t.target)&&co(t)&&(clearTimeout(this.Tr),this.Tr=setTimeout((()=>{this.Rr(this.Ir(t,"mousemove"))}),500))}Rr(i){if(t){var e=t.location.href,r=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=r?Fi([],or,s||[]):[],o=rr(e,n,lr);this.C=this.C||{},this.C[o]||(this.C[o]=[]),this.C[o].push(i)}}Ot(){this.C&&!F(this.C)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ve,webVitalsAutocapture:class{constructor(t){var i;this.cr=!1,this.er=!1,this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Cr=()=>{clearTimeout(this.Fr),0!==this.C.metrics.length&&(this._instance.capture("$web_vitals",this.C.metrics.reduce(((t,i)=>_({},t,{["$web_vitals_"+i.name+"_event"]:_({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Or=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(O(e))ro.error("Could not read session ID. Dropping metrics!");else{this.C=this.C||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Mr();if(!O(r))if(j(null==t?void 0:t.name)||j(null==t?void 0:t.value))ro.error("Invalid metric received",t);else if(this.Ar&&t.value>=this.Ar)ro.error("Ignoring metric with value >= "+this.Ar,t);else this.C.url!==r&&(this.Cr(),this.Fr=setTimeout(this.Cr,this.flushToCaptureTimeoutMs)),O(this.C.url)&&(this.C.url=r),this.C.firstMetricTimestamp=O(this.C.firstMetricTimestamp)?Date.now():this.C.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.C.metrics.push(_({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.C.metrics.length===this.allowedMetrics.length&&this.Cr()}},this.Dr=()=>{if(!this.er){var t,i,e,r,s=v.__PosthogExtensions__;O(s)||O(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.Or.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Or.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Or.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Or.bind(this)),this.er=!0):ro.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.cr=!(null==(i=this._instance.persistence)||!i.props[Xi]),this.startIfEnabled()}get allowedMetrics(){var t,i,e=C(this._instance.config.capture_performance)?null==(t=this._instance.config.capture_performance)?void 0:t.web_vitals_allowed_metrics:void 0;return j(e)?(null==(i=this._instance.persistence)?void 0:i.props[te])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(C(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=C(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return null!=t&&t}get Ar(){var t=C(this._instance.config.capture_performance)&&L(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:so;return 0{i?ro.error("failed to load script",i):t()}))}}Mr(){var i=t?t.location.href:void 0;if(i){var e=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties,s=e?Fi([],or,r||[]):[];return rr(i,s,lr)}ro.error("Could not determine current URL")}}},Qo={exceptionObserver:class{constructor(i){var e,r,s;this.Dr=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.jr&&this.N.capture_unhandled_errors&&(this.jr=e(this.captureException.bind(this))),!this.Lr&&this.N.capture_unhandled_rejections&&(this.Lr=r(this.captureException.bind(this))),!this.Nr&&this.N.capture_console_errors&&(this.Nr=s(this.captureException.bind(this)))}catch(t){to.error("failed to start",t),this.zr()}}},this._instance=i,this.Ur=!(null==(e=this._instance.persistence)||!e.props[Ji]),this.Hr=new Y({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,h:to}),this.N=this.Br(),this.startIfEnabledOrStop()}Br(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return C(t)?i=_({},i,t):(O(t)?this.Ur:t)&&(i=_({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.N.capture_console_errors||this.N.capture_unhandled_errors||this.N.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(to.info("enabled"),this.zr(),this.V(this.Dr)):this.zr()}V(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return to.error("failed to load script",i);t()}))}zr(){var t,i,e;null==(t=this.jr)||t.call(this),this.jr=void 0,null==(i=this.Lr)||i.call(this),this.Lr=void 0,null==(e=this.Nr)||e.call(this),this.Nr=void 0}onRemoteConfig(t){if("autocaptureExceptions"in t){var i=t.autocaptureExceptions;this.Ur=!!i||!1,this._instance.persistence&&this._instance.persistence.register({[Ji]:this.Ur}),this.N=this.Br(),this.startIfEnabledOrStop()}}onConfigChange(){this.N=this.Br()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.Hr.consumeRateLimit(s)?to.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,e;this.qr=[],this.Wr=new Qt([new vi,new xi,new fi,new ci,new yi,new bi,new _i,new wi],di()),this._instance=t,this.qr=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Ki))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r;if("errorTracking"in t){var s=null!==(i=null==(e=t.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.qr=s,this._instance.persistence&&this._instance.persistence.register({[Ki]:this.qr,[Yi]:n})}}get Gr(){var t,i=!!this._instance.get_property(Yi),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Wr.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}sendExceptionEvent(t){var i=t.$exception_list;if(this.Vr(i)){if(this.Jr(i))return void Bo.info("Skipping exception capture because a suppression rule matched");if(!this.Gr&&this.Kr(i))return void Bo.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Yr(i))return void Bo.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",Di:!0})}Jr(t){if(0===t.length)return!1;var i=t.reduce(((t,i)=>{var{type:e,value:r}=i;return M(e)&&e.length>0&&t.$exception_types.push(e),M(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.qr.some((t=>{var e=t.values.map((t=>{var e,r=Us[t.operator],s=I(t.value)?t.value:[t.value],n=null!==(e=i[t.key])&&void 0!==e?e:[];return s.length>0&&r(s,n)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}Kr(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Yr(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Vr(t){return!j(t)&&I(t)}}},Zo=_({productTours:class{constructor(t){this.Xr=null,this.Qr=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this._instance.persistence&&this._instance.persistence.register({[Zi]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,i;this.Xr||((t=this._instance).config.disable_product_tours||null==(i=t.persistence)||!i.get_property(Zi))||this.V((()=>this.Zr()))}V(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?fo.error("Could not load product tours script",i):t()}))}Zr(){var t;!this.Xr&&null!=(t=v.__PosthogExtensions__)&&t.generateProductTours&&(this.Xr=v.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!I(this.Qr)||i){var e=this._instance.persistence;if(e){var r=e.props[po];if(I(r)&&!i)return this.Qr=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:i=>{var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return fo.error(s),void t([],{isLoaded:!1,error:s})}var n=I(i.json.product_tours)?i.json.product_tours:[];this.Qr=n,e&&e.register({[po]:n}),t(n,{isLoaded:!0})}})}else t(this.Qr,{isLoaded:!0})}getActiveProductTours(t){j(this.Xr)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Xr.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Xr)||i.showTourById(t)}previewTour(t){this.Xr?this.Xr.previewTour(t):this.V((()=>{var i;this.Zr(),null==(i=this.Xr)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Xr)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Xr)||t.nextStep()}previousStep(){var t;null==(t=this.Xr)||t.previousStep()}clearCache(){var t;this.Qr=null,null==(t=this._instance.persistence)||t.unregister(po)}resetTour(t){var i;null==(i=this.Xr)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Xr)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Xr)||i.cancelPendingTour(t)}}},Ko),ta={siteApps:class{constructor(t){this._instance=t,this.ts=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}es(t,i){if(i){var e=this.globalsForEvent(i);this.ts.push(e),this.ts.length>1e3&&(this.ts=this.ts.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.es.bind(this));this.rs=()=>{t(),this.ts=[],this.rs=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(h))l[d]={id:u[d],type:d,properties:v};var{$set_once:c,$set:f}=t;return{event:_({},g(t,_o),{properties:_({},t.properties,f?{$set:_({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:_({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;(!i.errored&&this.ts.length&&(go.info("Processing "+this.ts.length+" events for site app with id "+t.id),this.ts.forEach((t=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored)))&&(null==(e=this.rs)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,go.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var{processEvent:n}=t.init({posthog:this._instance,callback:t=>{s(t)}});n&&(i.processEvent=n),r=!0}catch(i){go.error("Error while initializing PostHog app with config id "+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){go.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}ss(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}ns(t){if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t);for(var e of Object.values(this.apps))try{null==e.processEvent||e.processEvent(i)}catch(i){go.error("Error while processing event "+t.event+" for site app "+e.id,i)}}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.ss(),void this._instance.on("eventCaptured",(t=>this.ns(t)))):void go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.rs)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;v["__$$ph_site_app_"+t]=s._instance,null==(i=v.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return go.error("Error while initializing PostHog app with config id "+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},ia={tracingHeaders:class{constructor(t){this.os=void 0,this.ls=void 0,this.Dr=()=>{var t,i;O(this.os)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));O(this.ls)&&(null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}V(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return eo.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.V(this.Dr):(null==(t=this.os)||t.call(this),null==(i=this.ls)||i.call(this),this.os=void 0,this.ls=void 0)}}},ea=_({surveys:class{constructor(t){this.us=void 0,this._surveyManager=null,this.hs=!1,this.ds=[],this.vs=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var i=t.surveys;if(j(i))return Vs.warn("Flags not loaded yet. Not loading surveys.");var e=I(i);this.us=e?i.length>0:i,Vs.info("flags response received, isSurveysEnabled: "+this.us),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;ilocalStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.hs)Vs.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Vs.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Vs.info("Not loading surveys in cookieless mode without consent.");else{var t=null==v?void 0:v.__PosthogExtensions__;if(t){if(!O(this.us)||this._instance.config.advanced_enable_surveys){var i=this.us||this._instance.config.advanced_enable_surveys;this.hs=!0;try{var e=t.generateSurveys;if(e)return void this.cs(e,i);var r=t.loadExternalDependency;if(!r)return void this.fs("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.fs("Could not load surveys script",e):this.cs(t.generateSurveys,i)}))}catch(t){throw this.fs("Error initializing surveys",t),t}finally{this.hs=!1}}}else Vs.error("PostHog Extensions not found.")}}cs(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new wo(this._instance),Vs.info("Surveys loaded successfully"),this.ps({isLoaded:!0})}fs(t,i){Vs.error(t,i),this.ps({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.ds.push(t),this._surveyManager&&this.ps({isLoaded:!0}),()=>{this.ds=this.ds.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this._instance.config.disable_surveys)return Vs.info("Disabled. Not loading surveys."),t([]);var e,r=this._instance.get_property(ue);if(r&&!i)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.vs?this.vs.then((i=>{var{surveys:e,context:r}=i;return t(e,r)})):("undefined"!=typeof Promise&&(this.vs=new Promise((t=>{e=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var r;this.vs=null;var s=i.statusCode;if(200!==s||!i.json){var n="Surveys API could not be loaded, status: "+s;Vs.error(n);var o={isLoaded:!1,error:n};return t([],o),void(null==e||e({surveys:[],context:o}))}var a,l=i.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u));null==(r=this._instance.persistence)||r.register({[ue]:l});var h={isLoaded:!0};t(l,h),null==e||e({surveys:l,context:h})}}))}ps(t){for(var i of this.ds)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Vs.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!j(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Vs.warn("init was not called")}_s(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}gs(t){if(j(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var i="string"==typeof t?this._s(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(j(this._surveyManager))return Vs.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var i=this.gs(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return j(this._surveyManager)?(Vs.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.gs(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var r;if(j(this._surveyManager))Vs.warn("init was not called");else{var s="string"==typeof t?this._s(t):t;if(null!=s&&s.id)if(Xs.includes(s.type)){var n=null==o?void 0:o.querySelector(i);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(Vs.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;Vs.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),Vs.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,e);Vs.warn("Survey element not found")}else Vs.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Vs.warn("Survey not found")}}displaySurvey(t,i){var e;if(j(this._surveyManager))Vs.warn("init was not called");else{var r=this._s(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=_({},r,{appearance:_({},r.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Or&&i.initialResponses&&Vs.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void Vs.warn("Survey is not eligible to be displayed: ",n.disabledReason)}i.displayType!==Mr?this._surveyManager.handlePopoverSurvey(s,i):this.renderSurvey(s,i.selector,i.properties)}else Vs.warn("Survey not found")}}cancelPendingSurvey(t){j(this._surveyManager)?Vs.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},Ko),ra={toolbar:class{constructor(t){this.instance=t}bs(t){v.ph_toolbar_state=t}ys(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:So.UNINITIALIZED}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,r){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===r&&(r=void 0),Hi(this.instance.config))return!1;if(!t||!o)return!1;i=null!=i?i:t.location,r=null!=r?r:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var s,n=xo||sr(i.hash,"__posthog")||sr(i.hash,"state"),a=n?Mi((()=>JSON.parse(atob(decodeURIComponent(n)))))||Mi((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?i.hash=a.desiredHash:r?r.replaceState(r.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem($o)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(t){return!1}}ws(t){var i=v.ph_load_toolbar||v.ph_load_editor;!j(i)&&R(i)?i(t,this.instance):Eo.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==o||!o.getElementById(ye));if(!t||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=_({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(t.localStorage.setItem($o,JSON.stringify(_({},s,{source:void 0}))),this.ys()===So.LOADED)this.ws(s);else if(this.ys()===So.UNINITIALIZED){var n;this.bs(So.LOADING),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return Eo.error("[Toolbar] Failed to load",t),void this.bs(So.UNINITIALIZED);this.bs(So.LOADED),this.ws(s)})),Ui(t,"turbolinks:load",(()=>{this.bs(So.UNINITIALIZED),this.loadToolbar(s)}))}return!0}xs(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},sa=_({experiments:Wo},Ko),na={conversations:class{constructor(t){this.$s=void 0,this._conversationsManager=null,this.Es=!1,this.Ss=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var i=t.conversations;j(i)||(z(i)?this.$s=i:(this.$s=i.enabled,this.Ss=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.$s=void 0,this.Ss=null}loadIfEnabled(){if(!(this._conversationsManager||this.Es||this._instance.config.disable_conversations||Hi(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==v?void 0:v.__PosthogExtensions__;if(t&&!O(this.$s)&&this.$s)if(this.Ss&&this.Ss.token){this.Es=!0;try{var i=t.initConversations;if(i)return this.ks(i),void(this.Es=!1);var e=t.loadExternalDependency;if(!e)return void this.Ps("PostHog loadExternalDependency extension not found.");e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Ps("Could not load conversations script",i):this.ks(t.initConversations),this.Es=!1}))}catch(t){this.Ps("Error initializing conversations",t),this.Es=!1}}else Go.error("Conversations enabled but missing token in remote config.")}}ks(t){if(this.Ss)try{this._conversationsManager=t(this.Ss,this._instance),Go.info("Conversations loaded successfully")}catch(t){this.Ps("Error completing conversations initialization",t)}else Go.error("Cannot complete initialization: remote config is null")}Ps(t,i){Go.error(t,i),this._conversationsManager=null,this.Es=!1}show(){this._conversationsManager?this._conversationsManager.show():Go.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.$s&&!D(this._conversationsManager)}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return p((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(Go.warn("Conversations not available yet."),null)}))()}getMessages(t,i){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Go.warn("Conversations not available yet."),null)}))()}markAsRead(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Go.warn("Conversations not available yet."),null)}))()}getTickets(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Go.warn("Conversations not available yet."),null)}))()}requestRestoreLink(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Go.warn("Conversations not available yet."),null)}))()}restoreFromToken(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Go.warn("Conversations not available yet."),null)}))()}restoreFromUrlToken(){var t=this;return p((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Go.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}}},oa={logs:class{constructor(t){var i;this.Ts=!1,this.Is=!1,this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.Ts=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var i,e=null==(i=t.logs)?void 0:i.captureConsoleLogs;!j(e)&&e&&(this.Ts=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Ts&&!this.Is){var t=Si("[logs]"),i=null==v?void 0:v.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(e=>{var r;e||null==(r=i.logs)||!r.initializeLogs?t.error("Could not load logs script",e):(i.logs.initializeLogs(this._instance),this.Is=!0)})):t.error("PostHog loadExternalDependency extension not found.")}else t.error("PostHog Extensions not found.")}}}},aa=_({},Ko,Yo,Xo,Qo,Zo,ta,ea,ia,ra,sa,na,oa);dn.__defaultExtensionClasses=_({},aa),Vo=rn[on]=new dn,(Jo=v.posthog)&&Ri(Jo._i,(function(t){if(t&&I(t)){var i=Vo.init(t[0],t[1],t[2]),e=Jo[t[2]]||Jo;i&&(i._execute_array.call(i.people,e.people),i._execute_array(e))}})),v.posthog=Vo,function(){function i(){i.done||(i.done=!0,an=!1,Ri(rn,(function(t){t._dom_loaded()})))}null!=o&&o.addEventListener?"complete"===o.readyState?i():Ui(o,"DOMContentLoaded",i,{capture:!1}):t&&Ei.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}(); //# sourceMappingURL=array.js.map